Hi,
DeleteRange operates in ranges, full columns or full rows. It is the same method for everything, and in the same way InsertAndCopyRange can insert or copy or insert and copy a range, a group of rows or a group of columns from one sheet to the same, to another, or to a different workbook.
The idea is to have a small number of methods that do everything, instead of having a gazillion "InsertRange / InsertRow / InsertColumn /CopyColumn/ etc".
You have:
InsertAndCopyRange to deal with all the copying and inserting cells/rows/column stuff
DeleteRange to deal with deletions
MoveRange to deal with moving blocks of cells/columns/rows.
As for how it works, it is automatic. If you do
xls.DeleteRange(TXlsCellRange(1, 2, FlxConsts.Max_Rows + 1, 3, TFlxInsertMode.ShiftRangeRight);
FlexCel will detect you are deleting the full columns (2 and 3), and act as such.
But, there is also a simpler method. In TFlxInsertMode, there is one value that is "TFlxInsertMode.ShiftColRight"
which will always insert/remove full columns, no matter the range. So this call:
xls.DeleteRange(TXlsCellRange.Create(1,2,1,3), TFlxInsertMode.ShiftColRight);
will also remove the full column, no matter which rows you pass in the range. Whenever you are inserting/deleting rows or columns, it is simpler to use ShifColRight/ShiftRowsDown so you don't have to worry about all the rows/columns being selected.
A final note: I know some customers find it confusing that the enumeration is "ShiftColRight", and not "ShiftColLeft" (which is what actually happens when you remove a column). this is because it is the same enumeration used to insert columns, so when you insert "Right" is the correct direction. (and actually internally DeleteRange works by inserting -1 columns). But well, if I had to do it again, I might use 2 different enumerations, TFlxInsertMode.ShiftColRight and TFlxDeleteMode.ShiftColLeft. But well, other than the "strange" shifting right, when you are shifting left, DeleteRange(TClsCellrange.Create(1, Col1, 1, Coln), TFlxInsertMode.ShiftColRight) will remove columns from col1 to coln.
Regards,
Adrian.