Access violation with LoadfromFile
Any idea why I am getting an AV error when I call the Loadfromfile method.
Errant code is below:
if OpenDialog1.Execute then
ppReport1.Template.FileName := OpenDialog1.Filename;
ppReport1.Template.LoadFromFile; <------------------------------error is
here!
ppReport1.print;
I am using Advantage tables, Delphi 5 Enterprise.
I am using a Tppreport, TDBpipeline component. I do not get the error if I
comment out the LoadFromFile line, but I also cannot load a selected report
either.
Any help you could offer would be appreciated.
Brian
Errant code is below:
if OpenDialog1.Execute then
ppReport1.Template.FileName := OpenDialog1.Filename;
ppReport1.Template.LoadFromFile; <------------------------------error is
here!
ppReport1.print;
I am using Advantage tables, Delphi 5 Enterprise.
I am using a Tppreport, TDBpipeline component. I do not get the error if I
comment out the LoadFromFile line, but I also cannot load a selected report
either.
Any help you could offer would be appreciated.
Brian
This discussion has been closed.
Comments
Does the filename point to a valid report template? Can you load it using
the report deisgner to load from file? Is the template corrupt? Do you have
any event handlers assigned such as the Template's OnLoadStart or OnLoadEnd
event? What code is in those event handlers? If you cannot reproduce the
probem with our demos and do not see any problems in your code, then can you
point your library path to RBuilder\Source and see if you can see what line
is causing the problem. Feel free to send an example that demonstrates the
error in a simple delphi project in zip format to
support@digital-metaphors.com and we'll be happy to take a look at it.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
My experience is the Filename property of OpenDialog / SaveDialog
will be unassigned or assigned a dollar-sign('$') in some PCs (XP or
Win2000).
If we use Files.Strings[0] instead of FileName, it will be OK.
The problem is that we can't change the source of TppDesigner and
some users cannot use the functions involved OpenDialog/SaveDialog
in Report Designer. (e.g. Save to File / add a image in report header.)
Could you please change it for us?
Best regards,
Crystal Li
I didn't notice it until just now, but there is no Begin..End block around
this if statement. It will always call LoadFromFile.
if OpenDialog1.Execute then
ppReport1.Template.FileName := OpenDialog1.Filename;
ppReport1.Template.LoadFromFile;
As far as the dialog not returning a value, I imagine that this could only
happen if if the dialog was cancelled. I have not heard of this behavior
where the FileName property returns unassigned or returns a dollar sign when
the Execute return true. We use Win 2000 and XP here and have not run into
this problem. Can you send us an example that shows the problem in a simple
Delphi project support@digital-metaphors.com
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com