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.
adrian
(adrian)
December 3, 2015, 1:57am
2
Hi,
Try with
Xls.DeleteRange(1, 1, TXlsCellRange.Create(t, 1, t, 1), TFlxInsertMode.ShiftRow Down);
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);