Error openinng xls files.

Questions and answers on how to use XLSReadWriteII 5.

Error openinng xls files.

Postby AllanGMorris » Mon Jun 19, 2017 5:44 am

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
AllanGMorris
 
Posts: 5
Joined: Sat Dec 13, 2014 9:56 pm

Re: Error openinng xls files.

Postby larsa » Mon Jun 19, 2017 4:28 pm

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
larsa
Site Admin
 
Posts: 581
Joined: Mon Jun 27, 2005 9:30 pm

Re: Error openinng xls files.

Postby David » Tue Jul 11, 2017 1:17 pm

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.

Postby David » Wed Jul 12, 2017 11:10 am

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
David
 
Posts: 4
Joined: Wed Mar 02, 2011 6:46 am


Return to XLSReadWritwII 6

Who is online

Users browsing this forum: No registered users and 1 guest

cron