Can we convert a xls file to xlsx file in XLSReadWriteII4

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
bennylan
Posts: 4
Joined: Tue Dec 31, 2013 7:51 am

Can we convert a xls file to xlsx file in XLSReadWriteII4

Post by bennylan »

Hi,

Is it possible to convert a xls file (created in excel 2003) to xlsx file by using XLSReadWriteII 4? Thanks in advance.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Can we convert a xls file to xlsx file in XLSReadWriteII4

Post by larsa »

Hello

Probably not. Version 4 has very poor support for xlsx files.
Lars Arvidsson, Axolot Data
bennylan
Posts: 4
Joined: Tue Dec 31, 2013 7:51 am

Re: Can we convert a xls file to xlsx file in XLSReadWriteII4

Post by bennylan »

Thanks Larsa. Then i tried it in XLSReadWriteII 5, it seems okay, am i right?

Code: Select all

var
  xlsApp: TXLSReadWriteII5;
  fs: TFileStream;
begin
  xlsApp := TXLSReadWriteII5.Create(nil);
  try
    fs := TFileStream.Create('C:\Users\Benny\Desktop\test.xls', fmOpenRead);
    try
      xlsApp.LoadFromStream97(fs);
      xlsApp.SaveToFile('C:\Users\Benny\Desktop\test.xlsx');
    finally
      fs.Free;
    end;
  finally
    xlsApp.Free;
  end;
end;
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Can we convert a xls file to xlsx file in XLSReadWriteII4

Post by larsa »

Hello

It's enough to set:

Code: Select all

XLS.Version := xvExcel2007;
Lars Arvidsson, Axolot Data
Post Reply