Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-11

Looking for a reporting solution

8 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ramé

Hi, I'm looking for a method to allow me do what I do on Windows using FastReport, but in a cross platform way.

I need to let the user create a block of rich text with images for a header and footer, then a variable size block of rich text for the main content. Joining all three blocks forms a document, this document can be previewed and printed.

On Delphi, with FastReport, this is easy, all three blocks are RTF files, and the report engine handles page breaks, margins and everything automatically.

Now, with Lazarus/FreePascal, I don't know if LazReport accept RTF files, and I think it doesn't. So, maybe I can use lzRichEdit to allow the user create the text in a more or less WYSIWYG way, but as far as I know, it doesn't have a method to print.

Going further, I'm thinking of parsing the RTF files and create a PDF using fpVectorial, but I don't know how to handle page breaks, headers and footers.

How do you think I can solve this problem?.

Regards,

Reply by email

Felipe Monteiro de Carvalho
to Leonardo M. Ramé
Leonardo M. Ram? wrote
Going further, I'm thinking of parsing the RTF files and create a PDF using fpVectorial, but I don't know how to handle page breaks, headers and footers.

fpVectorial supports multiple pages, but not currently footers and also not headers, since they don't exist in vectorial images. You need to add an import module for rtf in fpvectorial which will convert the RTL into the standard entities from fpvectorial. Footers and headers can be converted into rectangles+text.

Felipe Monteiro de Carvalho

Reply by email

Leonardo M. Ramé
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 14 lines
On Sun, Nov 27, 2011 at 11:54 PM, Leonardo M. Ram? wrote: > Going further, I'm thinking of parsing the RTF files and create a PDF > using fpVectorial, but I don't know how to handle page breaks, headers > and footers. fpVectorial supports multiple pages, but not currently footers and also not headers, since they don't exist in vectorial images. You need to add an import module for rtf in fpvectorial which will convert the RTL into the standard entities from fpvectorial. Footers and headers can be converted into rectangles+text. -- Felipe Monteiro de Carvalho

Thanks, knowing how to handle pages, I can think of a way to handle headers/footers, after converting RTF to PDF that should be a peace of cake.

BTW. Do you know how can I convert pages from fpVectorial to Printer.Canvas, to send them directly to printer?.

Reply by email

Leonardo M. Ramé
to Vladimir Zhirov: Users can create ODT (OpenDocument Text) files using LibreOffice/OpenOffice Writer. You…
Vladimir Zhirov wrote 15 lines
Leonardo M. Ram? wrote: > I need to let the user create a block of rich text with images > for a header and footer, then a variable size block of rich > text for the main content. Joining all three blocks forms a > document, this document can be previewed and printed. > ... > ... to handle page breaks, headers and footers. Users can create ODT (OpenDocument Text) files using LibreOffice/OpenOffice Writer. You can pack/unpack them using TZipper/TUnzipper from FPC FCL and modify their xml content using DOM/XMLRead/XMLWrite. The result can be previewed and printed using Writer again. --

This can be the last alternative, I preffer something that does not requiere external (hughe) dependencies like OpenOffice/MsOffice.

Regards,

Reply by email

Felipe Monteiro de Carvalho
to Leonardo M. Ramé: Thanks, knowing how to handle pages, I can think of a way to handle headers/footers,…
Leonardo M. Ram? wrote
Thanks, knowing how to handle pages, I can think of a way to handle headers/footers, after converting RTF to PDF that should be a peace of cake.

Page support is a major part of fpvectorial, so it shows up in all basic example. See for example this:

http://wiki.lazarus.freepascal.org/fpvectorial#Adding_paths.2C_bezier_lines_and_text

BTW. Do you know how can I convert pages from fpVectorial to Printer.Canvas, to send them directly to printer?.

It is easy, just use DrawFPVectorialToCanvas, you can also scale the image with that, as expected from a vectorial graphics library.

http://wiki.lazarus.freepascal.org/fpvectorial#Rendering_the_image_into_a_TCanvas

Felipe Monteiro de Carvalho

Reply by email

Marcos Douglas
to Leonardo M. Ramé: This can be the last alternative, I preffer something that does not requiere external…
Leonardo M. Ram? wrote 19 lines
On 2011-11-29 19:33:26 +0300, Vladimir Zhirov wrote: > Leonardo M. Ram? wrote: > > I need to let the user create a block of rich text with images > > for a header and footer, then a variable size block of rich > > text for the main content. Joining all three blocks forms a > > document, this document can be previewed and printed. > > ... > > ... to handle page breaks, headers and footers. > > Users can create ODT (OpenDocument Text) files using > LibreOffice/OpenOffice Writer. You can pack/unpack them using > TZipper/TUnzipper from FPC FCL and modify their xml content > using DOM/XMLRead/XMLWrite. The result can be previewed and > printed using Writer again. > > -- This can be the last alternative, I preffer something that does not requiere external (hughe) dependencies like OpenOffice/MsOffice.

I think Graeme Geldenhuys uses the same technique, ie, ODT.

Marcos Douglas

Reply by email

Vladimir Zhirov
to Leonardo M. Ramé: Hi, I'm looking for a method to allow me do what I do on Windows using FastReport, but in…
Leonardo M. Ram? wrote 6 lines
I need to let the user create a block of rich text with images for a header and footer, then a variable size block of rich text for the main content. Joining all three blocks forms a document, this document can be previewed and printed. ... ... to handle page breaks, headers and footers.

Users can create ODT (OpenDocument Text) files using LibreOffice/OpenOffice Writer. You can pack/unpack them using TZipper/TUnzipper from FPC FCL and modify their xml content using DOM/XMLRead/XMLWrite. The result can be previewed and printed using Writer again.

Reply by email

Graeme Geldenhuys
to Marcos Douglas: I think Graeme Geldenhuys uses the same technique, ie, ODT. Marcos Douglas
Marcos Douglas wrote 13 lines
>> >> Users can create ODT (OpenDocument Text) files using >> LibreOffice/OpenOffice Writer. You can pack/unpack them using >> TZipper/TUnzipper from FPC FCL and modify their xml content >> using DOM/XMLRead/XMLWrite. The result can be previewed and >> printed using Writer again. >> >> -- > > This can be the last alternative, I preffer something that does not > requiere external (hughe) dependencies like OpenOffice/MsOffice. I think Graeme Geldenhuys uses the same technique, ie, ODT.

I use RTF files created with any RTF-enabled editor (OpenOffice, LibreOffice, MS Office etc). The RTF files are my report templates. I insert field markers where data must go. I also use hidden markers to notify my report engine what sections must grown (eg: lines of an Invoice). The report engine is include in tiOPF's repository named tiRTFParser.pas (inside the Quarantine directory). It should be quite easy to remove the tiOPF dependency without interfering with the report engine features.

The report engine is a single unit and can take data input from TDataset, TtiObjectList or Custom fed data via events. It supports images, user-defined functions (and already includes a whole bunch of them built-in). Once the report engine processed the document, you end up with a new populated RTF file which is your report. You can then preview it in read-only mode with OpenOffice (this hides all edit functions giving a really nice report preview screen. MS Office sucks in this regard). You can also use OpenOffice's built-in macros to generate a PDF from the RTF in silent mode (in the background without opening OpenOffice), and let the user preview the PDF instead. All this is possible in Linux and Windows. All our reporting is handled this way, and it works very well indeed. There is also no dependency on a GUI toolkit.

Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email