Home General

How to make a report fits in 1 single page ?

edited August 2001 in General
I'm using TExtraDevices to export to CSS2 file, but I want that only 1 page
to be generated. To do this I need that all the report fits in one page, so
I think that I must change the page size to a size that fits all the report
pages.

Question : How this can be done ?

Thanks !

Carlos

Comments

  • edited August 2001
    If you have static height bands, and know the record count before the report
    is run, then it might be possible to calculate the correct page height
    without generatng the report. If you do have dynamic height bands, and
    stretching components, you will have to generate the report to calculate the
    total height that the report needs to print, if it were to be printed on a
    single piece of theoretical paper. To make it accurate, you would have to
    remove the total height of all intermediate headers and footers, along with
    all repeated group headers.

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited August 2001
    I'm thinking to get the total number of generated pages and multiply it by
    the page.height to get the size of 1 page. But how can I do this is a
    single TppReport.Print ? Or is there some way to know how many pages the
    report will take before calling the print method ?

    I also tried to change the page size in the end1stPass of a 2 pass report,
    but it did not work.

    - Carlos

  • edited August 2001
    It looks like CSS2 will let you specify a large paper height on the printer
    setup of a report to print one long html page for the report. I created a
    simple report which did this.

    Okay, you can preview to the screen the entire report all as individual
    pages. Set the Report.PassSetting to psTwopass to get the total page count
    in the OnEndFirstPass event with Report.AbsolutePageCount. Then, when you
    select print from the previewer, the print dialog shows up, and you can
    select to print to CSS2. Then reconfigure the printer setup to print to one
    large page which is the page height * page count. The report should
    regenerate for this new page height.

    This code worked for me:


    TForm1....
    ...
    private
    { Private declarations }
    FHeightInMicrons: Integer;
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.DFM}
    uses
    ppUtils, ppTypes;

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    FHeightInMicrons := 25400 * 11;

    ppReport1.Print;
    end;

    procedure TForm1.ppReport1EndFirstPass(Sender: TObject);
    begin
    if (ppReport1.DeviceType = dtScreen) then
    FHeightInMicrons := ppReport1.AbsolutePageCount *
    ppReport1.PrinterSetup.PageDef.mmPrintableHeight;
    end;

    procedure TForm1.ppReport1PrintDialogClose(Sender: TObject);
    begin

    if (ppReport1.DeviceType = dtPrinter) then
    ppReport1.PrinterSetup.PaperHeight :=
    ppFromMMThousandths(FHeightInMicrons, utInches, pprtHorizontal,
    ppReport1.Printer);

    end;

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.