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

return to the original layout after changes by designer??

edited July 2002 in General
Hi,

How can I return to the original layout of a report, after make any changes
- by the designer editor, for example -
and before print??

Any TppReport method?

Thanks for any help.

Andre

Comments

  • edited July 2002
    Hi Andre,

    you have to reload the template.

    HTH,
    Chris Ueberall;

  • edited July 2002
    Hi Chris!

    I'm not loadding the report from a template.
    Let me explain: (Please, forgive my english!)

    In run time, based in a flag changed by the user , I change some visual
    characteristcs of some components. So the user load the report
    (TppReport.Print);
    If the user change the flag (to the default), and try to print again the
    report, I'd like to restore the original layout of the Report.

    ???
    Thanks again.

    Andre


  • edited July 2002
    There is an example of this technique:

    TForm1...

    private
    FStream: TMemoryStream;
    procedure MenuRevertOnClick(Sender: TObject);
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    uses
    ppTypes, Menus;

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ppDesigner1.ShowModal;
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    var
    lMenuItem: TMenuItem;
    begin
    lMenuItem := TMenuItem.Create(ppDesigner1.Menu);
    lMenuItem.Caption := 'Revert';
    lMenuItem.OnClick := MenuRevertOnClick;

    ppDesigner1.Menu.Items[0].Insert(4, lMenuItem);

    FStream := TMemoryStream.Create;
    ppReport1.Template.SaveToStream(FStream);
    end;

    procedure TForm1.MenuRevertOnClick(Sender: TObject);
    begin
    ppReport1.Template.LoadFromStream(FStream);
    end;

    procedure TForm1.FormDestroy(Sender: TObject);
    begin
    FStream.Free;
    end;


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited July 2002
    Great!
    I'll try....

    Regards,
    Andre

This discussion has been closed.