Access Violation when generating report!
I am testing how we can use Report Builder in an Intraweb application. What
i try to do is writing a file and then displaying it in a new browser
window. Here's my code for generating the PDF report:
procedure TProviderSum.lnkPDFClick(Sender: TObject);
var
LFile: string;
ReportName: string;
begin
LFile := Format('ITMReport%D.pdf', [UserSession.ReportNo]);
Inc(UserSession.ReportNo);
rbTHProviderSummaryGet.ShowPrintDialog := False;
rbTHProviderSummaryGet.DeviceType := dtPDF;
rbTHProviderSummaryGet.PDFSettings.OpenPDFFile := False;
rbTHProviderSummaryGet.TextFileName := IWServerController.UserCacheDir +
LFile;
rbTHProviderSummaryGet.Print;
WebApplication.NewWindow(IWServerController.UserCacheURL + LFile);
end;
This works great for the first display of the file, but when i try to
generate a second file it fails with an access violation. I also happens if
I do not open the file in a browser, but just writes the file. It works fine
the first time but when generating the second file it fails on the
rbTHProviderSummaryGet.Print statement.
Do I need to close or terminate somthing in between?!?
Regards,
Michael
i try to do is writing a file and then displaying it in a new browser
window. Here's my code for generating the PDF report:
procedure TProviderSum.lnkPDFClick(Sender: TObject);
var
LFile: string;
ReportName: string;
begin
LFile := Format('ITMReport%D.pdf', [UserSession.ReportNo]);
Inc(UserSession.ReportNo);
rbTHProviderSummaryGet.ShowPrintDialog := False;
rbTHProviderSummaryGet.DeviceType := dtPDF;
rbTHProviderSummaryGet.PDFSettings.OpenPDFFile := False;
rbTHProviderSummaryGet.TextFileName := IWServerController.UserCacheDir +
LFile;
rbTHProviderSummaryGet.Print;
WebApplication.NewWindow(IWServerController.UserCacheURL + LFile);
end;
This works great for the first display of the file, but when i try to
generate a second file it fails with an access violation. I also happens if
I do not open the file in a browser, but just writes the file. It works fine
the first time but when generating the second file it fails on the
rbTHProviderSummaryGet.Print statement.
Do I need to close or terminate somthing in between?!?
Regards,
Michael
This discussion has been closed.
Comments
I notice you are not setting Report.ShowCancelDialog to False.
Here is a short checklist for implementing a web solution:
a. Make sure that you provide a thread-safe container for the report to
execute.
b. Make sure that no dialogs are displayed by the report (i.e. set
Report.ShowPrintDialog, ShowCancelDialog, etc to False.
c. Set Report.EnableProcessMessages to False.
RB Server Edition provides an excellent solution for implementing web
solutions.
Live demo:
www.digital-metaphors.com/RBServerLive
Product info:
http://www.digital-metaphors.com/products/report_server/
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I am receiving a similar error. (see Access Violation in rtl100 several
messages before yours).
If ShowPrintDialog is set to true then it works OK.
Richard Harding
Try adding RBuilder\Source to your Delphi library path, position it just
above the entry for RBuilder\Lib.
Build the project with debugging turned on.
Configure the Delphi debugger to break on language exceptions.
Run the project and when the error occurs, examine the call stack. Perhaps
that will provide some clues.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com