Fpvectorial - Text Document Support

This is an old revision of Fpvectorial - Text Document Support, edited by Mike.cornflake at . The current revision is 93286.

/* Hello World Example */

(This page is currently under construction. I can't find how to hide this page while I'm working on it, so if you have accidentally stumbled across it: move along, move along, nothing to see here :-) )

FPVectorial - Document Support

Background

As the name suggests, FP Vectorial was originally created as a vector based image library. Support for creating documents was added to FP Vectorial as the existing architecture already had the concept of a Document containing Pages, and it's architecture was easily extendable. Document support was added to FP Vectorial beside the existing image handling classes. Vector based images are differentiated from office documents by the type of page added to TvVectorialDocument. At this time, two different pages can be added to TvVectorialDocument:

Currently there are two office document writers.

Instead of focusing on the requirements of each individual file format, Office Document support inside FPVectorial was added by creating and implementing a Document Class Hierarchy. It is then up to each individual reader and writer to interpret this class hierarchy. fpOdf Library
If you want to produce an ODT file by concentrating on the File Format, then the fpOdf library implemented by dgaspary and made available on the forums is recommended. This allows fine control when creating an ODT file, including many options not provided by FPVectorial - Document Support. Topic: fpOdf - Creating and modifying OpenDocument ODF files with freepascal

Download

fpvectorial comes in the Lazarus SVN, in the directory components/fpvectorial:

svn co http://svn.freepascal.org/svn/lazarus/trunk/components/fpvectorial fpvectorial

See also [FPVectorial]

Roadmap

Functionality OpenDocument (ODT) Office Open XML (DOCX)
File Version ODT 1.2 with extensions ECMA-376 1st Edition (2006)
Supported Style Types Paragraph and Text-Span Paragraph and Text
Table Support Yes Yes
List Support Partially Implemented (Bullets only) Partially Implemented (Bullets only)
Multiple Headers/Footers Not yet Yes
Tables in Header/Footer Not yet Not tested
Image Support Not yet Not yet
Images in Header/Footer Not yet Not yet
FPVectorial Image Support Not yet Not yet
Tab Stops Not yet Not yet
Document Fields Not yet Not yet
Meta Data Partially Implemented Not yet
Table of contents Not yet Not yet
Footnotes Not planned Not planned
Review/Revision Not planned Not planned
Bookmarks / Hyperlinks Not planned not planned
Comments Not planned Not planned

Hello World Example

The following code will produce a "Hello World" document. As no styles are defined, it is entirely up to the program used to open the resulting files (Microsoft Word, LibreOffice Write etc) to determine font and font size...

Program HelloWorld;

{$mode objfpc}{$H+}

Uses
  fpvectorialpkg, fpvectorial;

Var
  Document: TvVectorialDocument;
  Page: TvTextPageSequence;
  Paragraph: TvParagraph;

Begin
  Document := TvVectorialDocument.Create;
  Page := Document.AddTextPageSequence;
  Paragraph := Page.AddParagraph;
  Paragraph.AddText('Hello World!');

  Document.WriteToFile('Hello_World.docx', vfDOCX);
  Document.WriteToFile('Hello_World.odt', vfODT);
End.

Basic Concepts

Code Examples

Styles

Complex Paragraph

Bullet Lists

Numbered Lists

Simple Table

Table with Merged Cells

Known Issues

TODO

General

New Code

See Roadmap above...

Partially complete

ODTWriter