Problem with DeleteRows

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

Problem with DeleteRows

Post 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;
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Problem with DeleteRows

Post by larsa »

Hello

LastRow is only uppdated after you call CalcDimensions. The reason for this is that it takes some time to call CalcDimensions.
Lars Arvidsson, Axolot Data
Post Reply