I am currently working on a Labeling program in Delphi 7 and am using your wpForm component, the problem that I am having is that
I am using 2 wpFormEditor controls, one for the label designer and one for the preview (they are both on the same form).
After the label design is finished I output the report page by page, first creating a file and then using the write page method. (see below)
if WPFReportEngine2.ReportLoaded then WPFReportEngine2.Close; //Create the report file to append each page to WPFReportEngine2.CreateFile(installpath+'\selfit\Import\PrntPreview.wpr'); for i := 0 to (EndBadgeNo-StartBadgeNo) do Begin WPFReportEngine2.WritePage(i); end;
This all works fine I then load the report into the 2nd wpfFormEditor control (using the execute procedure below) and set it up like a preview
procedure TForm1.Execute(Printing: Boolean; const FileName: string);
begin
if fd <> nil then
begin
fd2.Form.Assign(fd.Form);
fd2.Page.Assign(fd.Page);
fd2.LabelDef.Assign(fd.LabelDef);
fd2.CurrentPage := 1;
end;
if FD2.ReportLoaded then WPFReportEngine1.Close;
Try
WPFReportEngine1.OpenFile(FileName);
Finally
WPFReportEngine1.SeekToPage(0,0);
//Setup the form designer in preview mode
FD2.options := FD2.Options + [wpfpreviewmode];
fd2.Labeldef.enabled := false;
fd2.Labeldef.setpapersize := true;
FD2.RefreshData(false);
end;
end;
Alles anzeigen
This also works fine, the problem is that when I put an image on the label thatI am designing and preview the report in this way (say for 200 labels)
a lot of memory is used up (this depends on the size of the image that has been inserted) and I can find no way to free up the used memory??
I have tried loading in a blank report but this doesn't help and everytime I preview the report I lose more and more memory. As the 2nd preview
formEditor is on the same form as the designer and is linked throughout the program (nearing the end of the project) I cannot create and destroy it
at runtime,
I would be very greatful if someone could help with any suggestions to this problem
many thanks
David Niziol