Free Support Forum -

Worksheet.Cells.MergedCells returns an inappropriate type in v4.8.0.0

This isn’t really a bug but it is counter-intuitive and isn’t strictly correct.

Worksheet.Cells.MergedCells is a read-only property that returns an ArrayList containing a list of the current merged cells in the sheet.

Unfortunately an ArrayList defaults to being read-write and you can do things like Remove the elements from the ArrayList but that has no affect on the spreadsheet - this must be because the ArrayList is just a copy of the underlying CellArea’s.

Ideally the Worksheet.Cells.MergedCells should return a read-only, strongly typed array of CellArea objects e.g. an IList




Yes, Cells.MergedCells (read-only property) returns an ArrayList and you may use this attribute to get merged cells in the worksheet, see the document:
Anyways, we will look into your suggestion if we can incorporate it or retain the existing one.

Thank you.