Problem with DeleteRange and Merged Cells


Hi, I’ve encountered a bug with using DeleteRange() along with meged cells. My designer file, code, and resultant XLS file are here: (FireFox doesn’t interpret the FTP addy right, use IE or explorer Sad). I’m using version

After inserting my DataTable I sometimes have to delete an unneeded column but not touch some header text up above, so I’m using DeleteRange with ShiftType.Left to nuke the column and its header. This works great except when there are merged cells to the right of the deletion, their contents get shifted over one but the cell doesn’t get deleted, it’s wierd. When I manually do the same operation in Excel it works as expected.

Here’s my DeleteRange() call:

ws.Cells.DeleteRange(2, 0, 5, 0, ShiftType.Left);


Hi David,

Thanks for your report. I fixed this issue and upload the hotfix to You can download it and have a try.


Thanks for the quick response man! I’ll give it a shot tomorrow morning.



Cool, the new verison works correctly with the test template, but exhibits the old behavor on my real template about half the time. If I copy the contents of the template to a new excel file and save DeleteRange() will work just fine on the column, but it still screws up on the old file. See GoodTemplate and BadTemplate in with a DeleteRange call of ws.Cells.DeleteRange(4, 1, 9, 1, ShiftType.Left); for each. I’ve uploaded the test page, too.

Hopefully it behaves the same way for you!


Fixed. Please download the hotfix again.

Laurence wrote:
Fixed. Please download the hotfix again.

Perfect! What in the heck was the difference between those two spreadsheets???


Just some cells with white spaces in the bad template. In previous version, the dll doesn't deal with this case. I fixed it in the new hotfix.