Change value on prepared report (fp3 file) before show (or print or export)

Hi,

I try to change the value of a MemoView after load the FP3 file.

It's a bil and i want to write a watermark "DUPLICATA".

Report.PreviewPages.LoadFromStream(lSTr);

Report.preparereport; // to have the event Report.EndDoc fired

Report.ShowPreparedReport;


On the EndDoc event :

 Report.Preview.Lock;

 Try

  for i := 0 to Report.PreviewPages.Count - 1 do begin

   List := Report.PreviewPages.Page[I].AllObjects;

   for J := 0 to List.Count - 1 do

    if CompareText('MEMWATERMARK', TfrxComponent(List[J]).Name) = 0 then begin

      TfrxMemoView(List.Items[J]).Lines.Text := Texte;

      Report.PreviewPages.ModifyPage(i, TfrxReportPage(Report.PreviewPages.Page[I]));

      Break;

     end;

  end;

 Finally

  Report.Preview.UnLock;

 End;


But i have an exception on the Report.preview.Lock;

What's wrong ?

Thank's

Comments

  • gpigpi Volnovakha, Ukraine

    Try

    Report.PreviewPages.LoadFromStream(lSTr);

    try

     for i := 0 to Report.PreviewPages.Count - 1 do begin

       List := Report.PreviewPages.Page[I].AllObjects;

       for J := 0 to List.Count - 1 do

        if CompareText('MEMWATERMARK', TfrxComponent(List[J]).Name) = 0 then begin

          TfrxMemoView(List.Items[J]).Lines.Text := Texte;

          Report.PreviewPages.ModifyPage(i, TfrxReportPage(Report.PreviewPages.Page[I]));

          Break;

         end;

      end;

     Finally

     End;

    Report.ShowPreparedReport;

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.