[fpc-pascal] FPReport: Split text across two or more pages

Michael Van Canneyt michael at freepascal.org
Tue Jan 2 00:02:35 CET 2024



On Mon, 1 Jan 2024, Pique7 via fpc-pascal wrote:

> Hello everyone,
>
> I have already asked this and related questions in the Lazarus Forum.
>
> I want to improve FPReport in order to use it for my project - if possible.
> Some features are missing for this, e.g. automatic splitting of text across two or more pages.
>
> As far as I can judge, the current development status of FPReport does not really allow me to extend it without modifying the original classes.

Why do you think so ?

> What approach do you suggest? Would this be feasible/reasonable at all? I ask this because I am new to Lazarus and FPC. I come from Delphi 2007 ...

If you ask me, it's perfectly doable without any changes.

There is a demo that shows how to print a text by splitting it in lines, and
simply printing a band per line. That will have the same effect as what you
seem to need.  Basically, it means using a TStringList as a data source
for a (sub)band instead of using it as the text of a single memo.

What you may need to do is to split the text "correctly" over the lines of the
TStringList, but that should be easily doable. All you need is a function to
calculate the length of the text.

I think this is perfectly doable without any changes to the original code.

Michael.


More information about the fpc-pascal mailing list