Free Support Forum - aspose.com

Find Merged Cell

Hi,

After moving to a cell, is there any way to find out whether this cell is either horizontally merged or vertically merged?

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Yes, there is VerticalMerge and HorizontalMerge properties. Please see the following links for more information.

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/aspose.words.tables.cellformat.horizontalmerge.html

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/aspose.words.tables.cellformat.verticalmerge.html

But note by design (by Microsoft Word design) rows in a table in a Microsoft Word document are completely independent. It means each row can have any number of cells of any width. So if you imagine first row with one wide cell and second row with two narrow cells, then looking at this document the cell in the first row will appear horizontally merged. But it is not a merged cell; it is just a single wide cell. Another perfectly valid scenario is when the first row has two cells. First cell hs CellMerge.First and second cell has CellMerge.Previous, in this case it is a merged cell. In both cases the visual appearance in MS Word is exactly the same. Both cases are valid.

Best regards.