Delete Excel Rows

Hello All.


I need some help to delete one entire row from one Excel File.
I tried with this:

        for t := 2 to Xls.RowCount do begin
          if Xls.GetCellValue(t, _CampoChaveToCutExcel).IsEmpty then
            Xls.DeleteRange(1, 1, TXlsCellRange.Create(t, 1, t, 1), TFlxInsertMode.ShiftRangeDown);
        end;

What is wrong with it? Is there a best way to do it?

Many thanks.

Hi,


Try with
Xls.DeleteRange(1, 1, TXlsCellRange.Create(t, 1, t, 1), TFlxInsertMode.ShiftRowDown);

ShiftRangeDown will shift just the range of cells, which goes from cell at row t and column 1 to cell at row t and column 1. So only column A will be deleted, all the other cells will remain in place.

ShiftRowDown is equvalent to 
Xls.DeleteRange(1, 1, TXlsCellRange.Create(t, 1, t, FlxConsts.Max_Columns + 1), TFlxInsertMode.ShiftRangeDown);