Saving prepared reports to PDF
I am creating a pdf with a number of reports using prepare report with clear false;
frxReport.showprepared report works fine.
saving the report from the preview window also works fine.
But using frxReport.Export with frxPDFExport only saves the last report and not all the prepared reports
Any ideas on what I am doing wrong>?
Comments
Any ideas anyone?
There must be some way to save a prepared report to PDF.
G'day Dave,
It would really help if we could see what you are doing that isn't working for you.
For example a sample project...
You are right it is possible and relatively straightforward. Our major App has several "composite reports" that are both saved to PDF from the Preview Form, and exported directly in one step.
But without an idea of what's "missing" in your code, it is hard to suggest improvements...
Cheers, Paul
I don't want to have it saved from the preview form.
I do all the preparation first.
frxReport.showprepared shows the prepared report and the save PDF button works
But if I do frxReport.Export with frxPDFExport, it only saves one report not all the prepared reports.
How can I save the prepared report WITHOUT the preview?
Thanks for replying.
Dave
I will try and send code when I get to my dev system
Here is a sample
if afrmWorksheetReportSelect.chkRatings.Enabled and
afrmWorksheetReportSelect.chkRatings.Checked then
begin
SetupReportData(wtEnergyRatings, lCompanyIndex);
frxReport.PrepareReport(lClearReport);
lClearReport := False;
end;
if afrmWorksheetReportSelect.chkImproved.Enabled and
afrmWorksheetReportSelect.chkImproved.Checked then
begin
SetupReportData(wtImprovedEnergyRatings, lCompanyIndex);
frxReport.PrepareReport(lClearReport);
lClearReport := False;
end;
if afrmWorksheetReportSelect.chkEPCCosts.Enabled and
afrmWorksheetReportSelect.chkEPCCosts.Checked then
begin
SetupReportData(wtCostEmissionAndEnergy, lCompanyIndex);
frxReport.PrepareReport(lClearReport);
lClearReport := False;
end;
if afrmWorksheetReportSelect.chkImprovedEPCCosts.Enabled and
afrmWorksheetReportSelect.chkImprovedEPCCosts.Checked then
begin
SetupReportData(wtImprovedCostEmissionAndEnergy, lCompanyIndex);
frxReport.PrepareReport(lClearReport);
lClearReport := False;
end;
if aFileName = '' then
frxReport.ShowPreparedReport
else
begin
dmUniqueFrxExport.frxPDFExport.FileName := aFileName;
dmUniqueFrxExport.frxPDFExport.ShowDialog := False;
frxReport.Export(dmUniqueFrxExport.frxPDFExport);
end;
If there is no filename is show the prepared report and all is well.
If there is a filename the expor5t only prints the last report prepared.
I have put in a support request
G'day Dave,
Probably the best way...
We put our code together 8 or 9 years ago, and I couldn't find the prototype we built. It was a simple Form that loaded three FR3 files and then either displayed a Preview or Export to PDF (depending on which Button you clicked). Our current Composite Reports are much more complex and dependent on inheritance, shared code and templates, so sharing them wouldn't help you!
I also tried to find a FR Tutorial on the subject. No go. Perhaps you could ask to Support Team to put one together...
Cheers, Paul
G'day again Dave,
OK so this "nagged at me" so much I recreated our "prototype". The attached files are the Project, Form and "dummy" FR3 files I used.
Running the Test Programme you can choose to Export Directly, or Preview first and Export using the Toolbar Button.
I verified that both actions get identical results by running a "BCompare" on the two PDF Files.
The ZIP File should contain all you need to reproduce my results. I have avoided relying on any external stuff or locally installed Components. It is about as basic as you can get.
I hope this moves you forward...
Cheers, Paul