Hello
Using the template store and having lots of problems where previously was no problem.
Every time we try to load a file from the template we get an error message.
'Error reading Excel records. File invalid'
or
'the file "" is invalid'
please advise
Hi,
Hello I am using 3.4 and RAD studio 2010
Here is the standard code...
Flexcelimport.OpenFile('ExcelCalc.xls');
TabControl.Tabs.Clear;
for p:=1 to FlexCelImport.SheetCount do
begin
FlexCelImport.ActiveSheet:=p;
TabControl.Tabs.Add(FlexCelImport.ActiveSheetName);
end;
FlexCelImport.ActiveSheet:=1;
TabControl.TabIndex:=FlexCelImport.ActiveSheet-1;
Data.LoadSheet;
the problem first appeared after I added about 4 or 5 files to template store.
I found I could fix the problem in two stages...
1. by putting an incorrect file name to load then when I run it the error would say correctly invalid
2. then when i changed it back to correct name it worked fine.
However I now have about 8 files and because of the problem I deleted all the files from the templete store then reloaded them.
Now whatever I try the error occurs when I try to load any file!
This is a real problem as now my application is completely broken.
I can't imagine what might be going wrong. I have just tried it here with lots of xls files, removing them and adding new ones, I have also reviewed the code, and I can't see any evident bugs. From the exception you are getting it looks like the stream gets corrupted (most likely truncated), but as said, the code for saving is quite simple (just dump the full stream into the form/datamodule, and read the full stream from the datamodule/form into memory).
I have tried delleting the flexcel components and replacing them but I still run into this problem.
what's your email address?
Hello Adrian
I tracked down a problem piece of code / third party component that appears to be causing the issue, I am not sure why.
I run the code at the start of form creation and the flexcel load procedure after.
The component is 'Kryvich's Delphi Localizer'
http://sites.google.com/site/kryvich/localizer
The component is a localiser for language strings, so I am guessing its causing a change to the string.
It is strange that the problem has got worse over time, yet the code for flexcel loading has not changed.
Thanks for you help.
Yes, I guess a localizer could mess with the files, since what FlexCelStore does is to save the xls file as a Base64 binary string inside the dfm. If the localizer tries to localize that "data string", it will most likely become invalid.