XLSReadWriteII 5 - FontColor

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
d3nton
Posts: 137
Joined: Thu Oct 25, 2012 9:48 am

XLSReadWriteII 5 - FontColor

Post by d3nton »

Hello.
I am sorry, but there seems to be another problem in XLSReadWriteII 5.
Setting the FontColor for multiple cells seems to be very very slow in the new version.
I used this delphi code in my XLSReadWriteII4 test project in order to set the fontcolor for the cells:

var
ExcelFile4: TXLSReadWriteII4;
lindex :Integer;
begin
ExcelFile4 := TXLSReadWriteII4.Create(nil);
ExcelFile4.Version := BIFFRecsII4.xvExcel2007;
ExcelFile4.Filename := 'D:\output.xlsx';
ExcelFile4.sheet[0].Name := 'test';
for lIndex := 0 to 10000 do begin
ExcelFile4[0].AsString[0,lIndex] := 'test';
ExcelFile4.Sheet[0].Cell[0,lIndex].FontColor := $5050FF;
end;
ExcelFile4.Write;
end;

The code works very well and takes only ~ 0,15 seconds.
The same code for XLSReadWriteII 5 takes more than 11 seconds:

var
ExcelFile5 : TXLSReadWriteII5;
lindex :Integer;
begin
ExcelFile5 := TXLSReadWriteII5.Create(nil);
ExcelFile5.Version := Xc12Utils5.xvExcel2007;
ExcelFile5.Filename := 'D:\output.xlsx';
ExcelFile5.Items[0].Name := 'test';
for lIndex := 0 to 10000 do begin
ExcelFile5[0].AsString[0,lIndex] := 'test';
ExcelFile5[0].Cell[0,lindex].FontColor := $5050FF;
end;
ExcelFile5.Write;
end;

I also tried
ExcelFile5[0].Range[0,0,1,9999].FontColor := $5050FF instead of the for loop
but this did not change anything.

Is there a way to speed up the process in order to get the performance of XLSReadWriteII 4?
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: XLSReadWriteII 5 - FontColor

Post by larsa »

Hello

This will be fixed in a later update.
Lars Arvidsson, Axolot Data
Post Reply