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
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;