coposite report pagesetup problem

if i try to change margins with pagesetup dialog using composite report
it rebuilds a page but it doesn't change anything
if i try without composite report , setupdialog change margins.

does anyone know how to resolve the problem?

thanks in advance

Comments

  • edited February 2004
    there is a bug in

    procedure TfrPreviewForm.PageSetupBtnClick(Sender: TObject);

    fr version 2.5 FR_View.pas unit

    i have modified the source code and now it works

    this is the code:

    procedure TfrPreviewForm.PageSetupBtnClick(Sender: TObject);
    var
    psd: TPageSetupDlg;
    pg: PfrPageInfo;
    pg1: TfrPage;
    i: Integer;
    s: Integer;
    rep: TfrReport;
    RepItem: TfrReport;
    Composite: TfrCompositeReport;

    procedure SetPrinter(DeviceMode, DeviceNames: THandle);
    var
    DevNames: PDevNames;
    begin
    DevNames := PDevNames(GlobalLock(DeviceNames));
    try
    with DevNames^ do
    Printer.SetPrinter(PChar(DevNames) + wDeviceOffset,
    PChar(DevNames) + wDriverOffset,
    PChar(DevNames) + wOutputOffset, DeviceMode);
    finally
    GlobalUnlock(DeviceNames);
    GlobalFree(DeviceNames);
    end;
    end;

    begin
    if EMFPages = nil then Exit;
    psd.lStructSize := SizeOf(TPageSetupDlg);
    psd.hwndOwner := ScrollBox1.Handle;
    psd.hDevMode := prn.DevMode;
    psd.hDevNames := 0;
    psd.Flags := PSD_DEFAULTMINMARGINS or PSD_MARGINS or PSD_INHUNDREDTHSOFMILLIMETERS;

    pg := TfrEMFPages(EMFPages)[0];
    psd.rtMargin.Left := pg^.pgMargins.Left * 500 div 18;
    psd.rtMargin.Top := pg^.pgMargins.Top * 500 div 18;
    psd.rtMargin.Right := pg^.pgMargins.Right * 500 div 18;
    psd.rtMargin.Bottom := pg^.pgMargins.Bottom * 500 div 18;

    if PageSetupDlg(psd) then
    begin

    rep := TfrReport(Doc);

    if rep.ClassNameIs('TfrCompositeReport') then
    begin
    Composite := (rep as TfrCompositeReport);
    for s := 0 to Composite.Reports.Count -1 do
    begin
    RepItem := TfrReport(Composite.Reports);
    for i := 0 to RepItem.Pages.Count - 1 do
    begin
    pg1 := RepItem.Pages;
    if pg1.PageType = ptReport then
    begin
    pg1.pgMargins.Left := psd.rtMargin.Left * 18 div 500;
    pg1.pgMargins.Top := psd.rtMargin.Top * 18 div 500;
    pg1.pgMargins.Right := psd.rtMargin.Right * 18 div 500;
    pg1.pgMargins.Bottom := psd.rtMargin.Bottom * 18 div 500;
    pg1.ChangePaper(Prn.PaperSize, 0, 0, Prn.Bin, Prn.Orientation);
    end;
    end;
    end;
    end
    else
    begin
    for i := 0 to TfrReport(Doc).Pages.Count - 1 do
    begin
    pg1 := TfrReport(Doc).Pages;
    if pg1.PageType = ptReport then
    begin
    pg1.pgMargins.Left := psd.rtMargin.Left * 18 div 500;
    pg1.pgMargins.Top := psd.rtMargin.Top * 18 div 500;
    pg1.pgMargins.Right := psd.rtMargin.Right * 18 div 500;
    pg1.pgMargins.Bottom := psd.rtMargin.Bottom * 18 div 500;
    pg1.ChangePaper(Prn.PaperSize, 0, 0, Prn.Bin, Prn.Orientation);
    end;
    end;
    end;

    SetPrinter(psd.hDevMode, psd.hDevNames);
    Prn.Update;

    TfrReport(Doc).PrepareReport;
    TfrEMFPages(EMFPages).Free;
    EMFPages := nil;
    Connect(Doc);
    RedrawAll(True);
    end;
    end;

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.