Copying of invisible columns does not work correctly when they are not included in the selection
Posted on:16 Jun 2016 07:46
It turns out that although the fix is quite easy it will break another default behavior. The thing is that we count on the Item and column's DisplayIndex of each of the cells in the SelectedCells collection. In that way, we can perform copying and pasting of cells from different columns and still keep their matrix structure. For example, if a user selects a cell from the first and the third column, we need to keep that information and save it in the clipboard accordingly. Thus, he/she will be able to paste them in Excel for instance in the same order - as the first and third cells.
When the case is like yours - inserting cells in SelectedCells collection - we still count on the DisplayIndex of the columns to calculate the matrix of cells and the regions they occupy so that pasting is correct afterwards.
Unfortunately, fixing the scenario when the cells are expected to be pasted one next to the other without the space of a missing column and without counting on DisplayIndex interferes with the one where the structure of the copied cells need to be saved.