Change papesize from code (Delphi)
I am trying to to change the height and width of the report page, selecting one of the supported sizes for the printer, I managed to get a list of the suported papers but I get only the papersize not the paper height or width individually, so, I tried selecting one of the papersizes on a combo and the passing that from Delphi to the report but the paper width and height do not change automatically as it says it does on the documentation.
do you know if it is a bug? because I do not have the personalized papersize selected and it doesn???t change width and height automatically.
if you know how to change the papersize from Delphi by code, could you show me?
I was trying to do something like this:
Page.PaperSize:= frxPrinters.Printer.PaperNameToNumber(ComboPapel.Items[ComboPapel.ItemIndex]);
do you know if it is a bug? because I do not have the personalized papersize selected and it doesn???t change width and height automatically.
if you know how to change the papersize from Delphi by code, could you show me?
I was trying to do something like this:
Page.PaperSize:= frxPrinters.Printer.PaperNameToNumber(ComboPapel.Items[ComboPapel.ItemIndex]);
Comments
I am wondering for example how you define / derive the parameter <Page>.
We have some reports where we allow the user to change between Portrait and Landscape modes, which might help you.
In our Reports' Common Code where <Report> is the TfrxReport Component's name.
We use <Page> to set the necessary TfrxReportPage Properties (Orientation, BottomMargin etc.).
I believe you could use <Page> to set the PaperSize Property, or PaperHeight / PaperWidth. Reading those values in our test module, we get PaperSize=9 PaperHeight=297 PaperWidth=210 (for A4 Portrait).
Note the <Index> of "1" in the <Page> assignment statement. Our Report designs have avoided multi-page definitions.
If your reports contain more than one page definition you will need to consider iterating through of them.
Hope this helps [img]style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> Cheers, Paul[/img]
Hi Paul, first, thank you so much for replying.
now, im using: Page:= rfxReport.FindObject('Page1') as TfrxReportPage; in order to get the page from the report, and it does change the integer value of the papersize in the report but it has no effect, and I read on the fasReports documentation that changing the papersize should change automatically the width and height of the page, that???s what I want to do but it is having no effect. my report is single page and I use it for printing labels in a thermal brother printer.
if you know how to fix that problem I would be pretty thankful, thanks in advance and for replying
Hiram.
It's work!
case ATicketSize of
ttt58mm: TFrxReportPage(AReport.Pages[1]).PaperWidth := 58;
ttt80mm: TFrxReportPage(AReport.Pages[1]).PaperWidth := 80;
end;
if AReport.PrepareReport() then
begin
Result := AReport.Print;
end;