Page 1 of 1

Severe Bug in XLSReadWriteII4

Posted: Sun Jun 01, 2008 9:50 am
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

Posted: Mon Jun 02, 2008 6:43 am
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

Severe Bug in XLSReadWriteII4

Posted: Mon Jun 02, 2008 1:01 pm
by PStadler
Hello,

Yes, that what I wanted to say.

Sincerely

Peter

Posted: Fri Jun 13, 2008 5:42 am
by larsa
Hello

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


Lars Arvidsson, Axolot Data