Problem with DeleteRows
Posted: Sun Oct 07, 2012 7:11 pm
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;
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;