What is the best way to Cancel PDF Export?
Polomint
Australia
OK situation is this. A User regularly gets exceptions in our App when an attempt is made to Export to PDF a FastReport, caused by another User having an earlier version of the file open.
Their ideal solution is a "friendly" warning the filename is not available with a choice to either cancel, or save it by another name / in another folder.
The two exposed events for TfrxPDFexport look like the place to do it, with a preference for BeginExport (as it follows the two dialogue boxes for PDF properties and save name / location).
Experiments have successfully detected an "in use" file, but so far show no way to Cancel the report.
Any suggestions?
Cheers, Paul
PS we have v6.1.12 installed.
EDIT:
Oh and experiments also show that we can't change the Filename property of TfrxPDFexport in BeginExport - so Cancel is going to be our only option, if we can work out how to do it.
Their ideal solution is a "friendly" warning the filename is not available with a choice to either cancel, or save it by another name / in another folder.
The two exposed events for TfrxPDFexport look like the place to do it, with a preference for BeginExport (as it follows the two dialogue boxes for PDF properties and save name / location).
Experiments have successfully detected an "in use" file, but so far show no way to Cancel the report.
Any suggestions?
Cheers, Paul
PS we have v6.1.12 installed.
EDIT:
Oh and experiments also show that we can't change the Filename property of TfrxPDFexport in BeginExport - so Cancel is going to be our only option, if we can work out how to do it.
Comments
In the absence of any alternative, and for those who might want to do something similar...
We've opted to raise an Exception, and have found (reading through the FastReport Source) that EExportTerminated class is a "silent" exception which seems to work without negative consequences.
We've opted to add new code at the end of the common routine that all our reports use for TfrxPDFexport.OnBeginExport. It loops while our FileInUse (FileName) function returns True, and the User has not selected Cancel. On selecting Cancel we raise the silent exception.
Cheers, Paul
__________________
Epson Klantenservice