Error openinng xls files.

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
AllanGMorris
Posts: 5
Joined: Sat Dec 13, 2014 9:56 pm

Error openinng xls files.

Post by AllanGMorris »

Hi,

I have an issue opening xls files (excel97-2003 format), I am getting a strange error of Missing Password and XLSX files are read OK without any issue.

I have tried to open with a specific version by setting the version:
SampleWorkbook:= TXLSReadWriteII5.Create(Nil);
SampleWorkbook.Filename := 'a.xls';
SampleWorkbook.Version:=xvExcel97;
SampleWorkbook.read;

and it still has an error??

Thanks
Allan
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Error openinng xls files.

Post by larsa »

Hello

Your code shall work ok. Can you send me the XLS file and I will take a look at it?
Lars Arvidsson, Axolot Data
David
Posts: 4
Joined: Wed Mar 02, 2011 6:46 am

Re: Error openinng xls files.

Post by David »

Hi

I am receiving the same error when trying to open xls files: "Missing Password".
I have tried both:
XLSReader := TXLSReadWriteII5.Create(nil);
XLSReader.Filename := 'file.xls';
XLSReader.Version := xvExcel97;
XLSReader.Read;
and
XLSReader := TXLSReadWriteII5.Create(nil);
XLSReader.Version := xvExcel97;
XLSReader.LoadFromFile(file.xls);

I can read in xlsx files without getting the above error.

Was this issue previously resolved?

Thanks
David
David
Posts: 4
Joined: Wed Mar 02, 2011 6:46 am

Re: Error openinng xls files.

Post by David »

Hi

I have now debugged through the code using the source files instead of the complied code fields and found out where I am receiving the "Missing Password" error.
Although I set the version of Excel upfront before calling the Read procedure, within the TXLSReadWriteII5.LoadFromFile
procedure which is called from Read, it tries to determine what version of Excel is being used by examining the file extension.
The file is only processed as an Excel 97 file if the extension is '.xls' or '.xlm'. Else it gets treated as an Excel 2007 file and when
the code tries to process it i fails.
As we assign temporary names to files stored in a database this is why our .xls files are not being read as the file extension is no .xls
at this point.

Regards
David
Post Reply