Severe Bug in XLSReadWriteII4

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
PStadler
Posts: 44
Joined: Sat Feb 18, 2006 8:19 am

Severe Bug in XLSReadWriteII4

Post by PStadler »

Hello,

I open an Excel-File with 2189 lines in PaintCellSample. Then I write it,
after write it contains 4237 lines. I check the line number before and after write with:
CheckRows1 := XLS.Sheets[0].LastRow;
In Excel these added lines do not exist or are empty.


Here you can see a screen shot
https://winserion.org/BugReports/Write_Error.png

Please change https to h t t p to see the image.

I cannot understand, why h t t p may not be written here!!!!!!!!!!!!

To make the Excel2007 in compatibility mode file not write protected after save, I use the proposed code, see below.

I changed only this procedure from the example:

procedure TfrmMain.Button2Click(Sender: TObject);
var
i: integer;
checkRows1 : Cardinal;
checkRows2 : Cardinal;
begin
XLS.Filename := edFilename.Text;
XLS.Read;
TabSet.Tabs.Clear;
for i := 0 to XLS.Sheets.Count - 1 do
TabSet.Tabs.Add(XLS.Sheets.Name);
TabSet.TabIndex := 0;
Grid.Invalidate;

for i := 0 to XLS.Sheets.Count - 1 do
begin
XLS.Sheets.SheetProtection:=[spEditObjects,spEditScenarios,
spEditCellFormatting,spEditColumnFormatting,spEditRowFormatting,
spInsertColumns,spInsertRows,spInsertHyperlinks,spDeleteColumns,
spDeleteRows,spSelectLockedCells,spSortCellRange,spEditAutoFileters,
spEditPivotTables,spSelectUnlockedCells];
end;
CheckRows1 := XLS.Sheets[0].LastRow;
XLS.Write;
CheckRows2 := XLS.Sheets[0].LastRow;
Dialogs.ShowMessage(SysUtils.FloatToStr(checkRows1)+' lines, after write '+SysUtils.FloatToStr(checkRows2)+' lines');
end;

I hope that Larsa will answer this.

I now returned to XLSReadWriteII3 and everything is fine.

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

Post by larsa »

Hello

Do I understand this correct:

1. You open a file.

2. LastRow returns 2189.

3. You call Write().

4. LastRow returns 4237.


Lars Arvidsson, Axolot Data
PStadler
Posts: 44
Joined: Sat Feb 18, 2006 8:19 am

Severe Bug in XLSReadWriteII4

Post by PStadler »

Hello,

Yes, that what I wanted to say.

Sincerely

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

Post by larsa »

Hello

Sorry, I can't reproduce this. Can you please send me the file that you uses?


Lars Arvidsson, Axolot Data
Post Reply