Problem with PaperSize
I use the following code to create a report with a blank page using DMPAPER_LETTER size.
When I execute this code, it generate a .FR3 file that contain the following line :
The file seems to be good, but when I open it with the designer and go to "File" -> "Page Settings...", the size is set to "Custom" with a width of 21.59 (instead of 21.60) and a height of 27.94 (instead of 27,90).
If I select the size "Letter" manually and save the report, the .FR3 file now contain the following line :
The only difference is the PaperSize is set to 119 instead of 1. When looking in Windows.pas, "DMPAPER_LAST = 118" so 119 should be an invalid PaperSize.
TL;DR : To assign Letter as the PaperSize for a page, we need to specify the value 119 instead of 1 (DMPAPER_LETTER).
var
  frxReport: TfrxReport;
  frxReportPage: TfrxReportPage;
begin
    frxReport := TfrxReport.Create(nil);
    frxReportPage := TfrxReportPage.Create(frxReport);
    frxReportPage.CreateUniqueName;
    frxReportPage.PaperSize := DMPAPER_LETTER;
    //frxReportPage.SetSizeAndDimensions(DMPAPER_LETTER,216,279); // I tried this and it gives me the same result as the line above
    frxReport.SaveToFile('C:\Test.fr3');
    frxReport.Free;
end;
When I execute this code, it generate a .FR3 file that contain the following line :
<TfrxReportPage Name="Page1" PaperWidth="216" PaperHeight="279" PaperSize="1" ...
The file seems to be good, but when I open it with the designer and go to "File" -> "Page Settings...", the size is set to "Custom" with a width of 21.59 (instead of 21.60) and a height of 27.94 (instead of 27,90).
If I select the size "Letter" manually and save the report, the .FR3 file now contain the following line :
<TfrxReportPage Name="Page1" PaperWidth="216" PaperHeight="279" PaperSize="119" ...
The only difference is the PaperSize is set to 119 instead of 1. When looking in Windows.pas, "DMPAPER_LAST = 118" so 119 should be an invalid PaperSize.
TL;DR : To assign Letter as the PaperSize for a page, we need to specify the value 119 instead of 1 (DMPAPER_LETTER).
Comments