getHighestColumn() not recalculated when deleting columns with removeColumn

Topics: Developer Forum
Feb 25, 2013 at 12:38 PM
How can I delete lets say 10 Columns in such a way, that the getHighestColumn() returns a counter reduced by 10.

removeColumn('somecolumn', 10) does not do this in my case.
Feb 25, 2013 at 2:07 PM
You're correct, for a couple of reasons...
  • Currently, PHPExcel doesn't actually remove the columns; it simply "moves" the subsequent columns across leaving a block of blank columns at the end, so the actual column count remains the same. However, the refactoring work that I've been doing on the cells structure for the 1.7.9 release will make it more efficient to actually remove those trailing columns, and I shall be working on that in due course.
  • Secondly, a cell beyond the range of data may still contain information such as styling, or serve as a placeholder for charts or images; and the highest column value takes these details into account as well.
  • There is a getHighestDataColumn value that actively calculates the highest cell value when called.