Page 1 of 1

Problem with DeleteRows

Posted: Sun Oct 07, 2012 7:11 pm
by PStadler
Hello,

I have a problem with deleting a row in this function below. rows1 and rows2 after the deletion give always the same value. So the deletion of a row is
not reflected by XLSData.Sheets[0].LastRow;

How can it be updated?

I am using the last version of XLSReadWriteII together with Delphi XE2.

Sincerely Peter

function TXLSForm.DeleteRowFromExcel(Row: cardinal): boolean;
var
rows1, rows2: cardinal;
begin
rows1 := XLSData.Sheets[0].LastRow;
XLSData.DeleteRows(0, Row, Row);
rows2 := XLSData.Sheets[0].LastRow;
if (rows2 = rows1 - 1) then
begin
DeleteRowFromExcel := True;
end
else
begin
DeleteRowFromExcel := False;
end;

Re: Problem with DeleteRows

Posted: Mon Oct 08, 2012 6:30 pm
by larsa
Hello

LastRow is only uppdated after you call CalcDimensions. The reason for this is that it takes some time to call CalcDimensions.