Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

optimized column width (II)

edited September 2005 in General
Hi,

some weeks ago (2005-08-19), I'd started a thread "optimized column width".
I've made my reports along the suggestions to calculate column width while
reading the Dataset by myself and using a canvas of the desired printer.
But now I'm working on a more complex report with columns that are visible
only in some cases, with group sums.
And a TppDBMemo that would like to use the free space of unvisible columns
to omit additional lines.
All is fine, but in some cases the sum-fields need more room than the data
in the detail.
No I've to extend the measuring feature to calculate sums and consider its
Textwidth.

But I think in more complex reports it's better to use the reports logic to
optimize columns-width. It needs more time, but my reports are small
enough.
Now my idea is to do a two-phase-print:
1. print the report to a dummy-device and measure all columns with desired
ppPrinter.canvas
2. set the Left/Width of all concerned TppPrintable.
3. print it to desired user device.

Is there a dummy device for RB or should I use dvFile into e meaningless
temp-file?
Or is there method like Quickreport's Prepare-method I've used for that
solution in old QR-Times?


--
Best regards
Dietmar Brueckmann

Comments

  • edited September 2005
    Hi Dietmar,

    If you create a generic TppDevice object and assign it's publisher to the
    report's you will essentially be printing to a "dummy" device where you can
    make these calculations. For instance...

    var
    lDevice: TppDevice;
    begin

    lDevice := TppDevice.Create(nil);
    lDevice.Publisher := ppReport1.Publisher;
    ppReport1.PrintToDevices;

    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.