Export to Excel error (RB 15.01)
Hello
When exporting to Excel I get the error copied to the end of this
message. For your information, my code is:
reExcelData :
begin
aReport.DeviceType := dtXLSData;
aReport.XLSSettings.Author :=
TnxRulesAndSettings.OurCompanyName;
aReport.XLSSettings.Title := aReportDetails.MenuCaption;
if viaPreviewForm then
begin
lXLSDataDevice := TppXLSDataDevice.Create(nil);
lXLSDataDevice.FileName := aReport.TextFileName;
lXLSDataDevice.XLSSettings := aReport.XLSSettings;
lXLSDataDevice.Publisher := aReport.Publisher;
aReport.PrintToDevices;
lXLSDataDevice.free;
end
else
aReport.Print;
end;
...and "viaPreviewForm" is true and "aReport" is the same TppReport that
is visible in a PreviewForm.
works fine with PDF, RTF, CSV, etc.
compiled with : Delphi 2006/07
madExcept version : 4.0.6
callstack crc : $a2339e57, $1d8d14bf, $779ac740
exception number : 1
exception class : EAccessViolation
exception message : Access violation at address 00DC67C5 in module
'HireTrackNX.exe'. Read of address 00000020.
main thread ($134c):
00dc67c5 HireTrackNX.exe ppXLSSettings 249
TppXLSSettings.GetOpenXLSFile
00d952d8 HireTrackNX.exe ppXLSDevice 391
TppXLSDeviceBase.GetOpenFile
00dbdcb2 HireTrackNX.exe ppFilDev 1140 TppFileDevice.EndJob
00d952bc HireTrackNX.exe ppXLSDevice 382 TppXLSDeviceBase.EndJob
00dbd33c HireTrackNX.exe ppFilDev 700 TppStreamDevice.Destroy
00dbd76f HireTrackNX.exe ppFilDev 897 TppFileDevice.Destroy
00d95231 HireTrackNX.exe ppXLSDevice 342 TppXLSDeviceBase.Destroy
0040503c HireTrackNX.exe System 744 TObject.Free
0131c003 HireTrackNX.exe nxReportingCommonU 2062 TrbReporting.ExportToFile
011fa37f HireTrackNX.exe nxRBPreview 152
TRBPrintPreview.ExportReport
011f9ca2 HireTrackNX.exe nxReportingBtnU 45
TnxReportingBtnForm.ExportBtnClick
004dcdd8 HireTrackNX.exe Controls 5229 TControl.Click
0111b63e HireTrackNX.exe AdvSmoothButton 464 TAdvSmoothButton.
When exporting to Excel I get the error copied to the end of this
message. For your information, my code is:
reExcelData :
begin
aReport.DeviceType := dtXLSData;
aReport.XLSSettings.Author :=
TnxRulesAndSettings.OurCompanyName;
aReport.XLSSettings.Title := aReportDetails.MenuCaption;
if viaPreviewForm then
begin
lXLSDataDevice := TppXLSDataDevice.Create(nil);
lXLSDataDevice.FileName := aReport.TextFileName;
lXLSDataDevice.XLSSettings := aReport.XLSSettings;
lXLSDataDevice.Publisher := aReport.Publisher;
aReport.PrintToDevices;
lXLSDataDevice.free;
end
else
aReport.Print;
end;
...and "viaPreviewForm" is true and "aReport" is the same TppReport that
is visible in a PreviewForm.
works fine with PDF, RTF, CSV, etc.
compiled with : Delphi 2006/07
madExcept version : 4.0.6
callstack crc : $a2339e57, $1d8d14bf, $779ac740
exception number : 1
exception class : EAccessViolation
exception message : Access violation at address 00DC67C5 in module
'HireTrackNX.exe'. Read of address 00000020.
main thread ($134c):
00dc67c5 HireTrackNX.exe ppXLSSettings 249
TppXLSSettings.GetOpenXLSFile
00d952d8 HireTrackNX.exe ppXLSDevice 391
TppXLSDeviceBase.GetOpenFile
00dbdcb2 HireTrackNX.exe ppFilDev 1140 TppFileDevice.EndJob
00d952bc HireTrackNX.exe ppXLSDevice 382 TppXLSDeviceBase.EndJob
00dbd33c HireTrackNX.exe ppFilDev 700 TppStreamDevice.Destroy
00dbd76f HireTrackNX.exe ppFilDev 897 TppFileDevice.Destroy
00d95231 HireTrackNX.exe ppXLSDevice 342 TppXLSDeviceBase.Destroy
0040503c HireTrackNX.exe System 744 TObject.Free
0131c003 HireTrackNX.exe nxReportingCommonU 2062 TrbReporting.ExportToFile
011fa37f HireTrackNX.exe nxRBPreview 152
TRBPrintPreview.ExportReport
011f9ca2 HireTrackNX.exe nxReportingBtnU 45
TnxReportingBtnForm.ExportBtnClick
004dcdd8 HireTrackNX.exe Controls 5229 TControl.Click
0111b63e HireTrackNX.exe AdvSmoothButton 464 TAdvSmoothButton.
This discussion has been closed.
Comments
i have the same problem - so i add my report to your thread.
The error occurs when exporting to PDF - so it seems to me that all FileDevices
are affected.
With RB 15.00 everything works fine - i just updated to RB 15.01.
Delphi 7 / Windows 8
Error message:
Zugriffsverletzung bei Adresse 00A23208 in Modul 'abc.exe'. Lesen von Adresse
00000040
Call stack information:
----------------------------------------------------------------------------------------------------------
|Address |Module |Unit |Class |Procedure/Method
|Line |
----------------------------------------------------------------------------------------------------------
|*Exception Thread: ID=4344; Priority=0; Class=; [Main]
|
|---------------------------------------------------------------------------------------------------------
|00A23208|abc.exe|ppPDFSettings.pas |TppPDFSettings |GetOpenPDFFile
|494[1] |
|00A23200|abc.exe|ppPDFSettings.pas |TppPDFSettings |GetOpenPDFFile
|493[0] |
|009D1643|abc.exe|ppPDFDevice.pas |TppPDFDevice |GetOpenFile
|513[1] |
|00A1AED6|abc.exe|ppFilDev.pas |TppFileDevice |EndJob
|1140[22] |
|00A1AE38|abc.exe|ppFilDev.pas |TppFileDevice |EndJob
|1118[0] |
|009D0F10|abc.exe|ppPDFDevice.pas |TppPDFDevice |EndJob
|331[5] |
|00A1A540|abc.exe|ppFilDev.pas |TppStreamDevice |Destroy
|700[4] |
|00A1A524|abc.exe|ppFilDev.pas |TppStreamDevice |Destroy
|696[0] |
|00A1A98E|abc.exe|ppFilDev.pas |TppFileDevice |Destroy
|897[16] |
|00A1A924|abc.exe|ppFilDev.pas |TppFileDevice |Destroy
|881[0] |
|009D0A94|abc.exe|ppPDFDevice.pas |TppPDFDevice |Destroy
|212[16] |
|00404A5C|abc.exe|system.pas |TObject |Free
|8385[2] |
|00404A54|abc.exe|system.pas |TObject |Free
|8384[1] |
|00C3A0EF|abc.exe|rb_myPreviewer.pas |Trb_MyPreviewer_Form |BtnPDFClick
|487[25] |
Code inside TRB_MyPreviewer_Form:
r:= TppReport(Report);
r.TextFileName:= sdPDF.FileName;
// delete existing file
if FileExists(r.TextFileName) then
DeleteFile(r.TextFileName);
// creat and configure the PDFDevice
lPDFDevice := TppPDFDevice.Create(nil);
FOutputStream := TMemoryStream.Create;
try
lPDFDevice.PDFSettings := r.PDFSettings;
lPDFDevice.OutputStream := FOutputStream; // assign output stream
lPDFDevice.Publisher := r.Publisher;
// generate the report
r.PrintToDevices;
FOutputStream.SaveToFile(r.textfilename);
ShellExecute(0, 'open', PChar(r.textfilename), nil, nil, SW_SHOW);
finally
lPDFDevice.Free;
end;
Greetings
Stefan Kirchhoff
Have a look at Viewer.Print in ppViewr.pas. It shows how to disconnect the
screen device from the publisher and then print and then re-attach it.
Otherwise the report will print to multiple devices at the same time - not
what you want here, especially if using the scrolling page preview which
generates a background thread. Below is an example..
uses
ppViewr,
ppScreenDevice;
var
lScreenDevice: TppCustomScreenDevice;
begin
lScreenDevice := TppViewer(ppReport1.PreviewForm.Viewer).ScreenDevice;
lScreenDevice.Publisher := nil; // disconnt screen device
// print to file code goes here
lScreenDevice.Publisher := Report.Publisher // reconnect screen device
end;
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
As it happens my report's PreviewForm property is NIL because of the way
I assign the report to my custom viewer:
FPreview := TppPreviewPlugIn.CreatePreviewPlugin(MainPanel);
FPreview.Viewer.Report := FReportExecute.Report;
However, I just modified my ExportFile() routine so that it passes
FPreview and then I had a handle on it to do what you recommend. And
I'm pleased to say IT WORKED!
Cheers, Paul