Having trouble detecting horizontal cell spans in a word table

Hi,


In desperation I used your example code to see whether it detects cells spans correctly.
The output for the attched word file is as follows which does not report a horizontal merge?

Help !!

The cell at R1, C1 is not merged
The cell at R1, C2 is not merged
The cell at R1, C3 is not merged
The cell at R1, C4 is not merged
The cell at R2, C1 is not merged
The cell at R2, C2 is not merged
The cell at R2, C3 is not merged
The cell at R2, C4 is vertically merged
The cell at R2, C5 is not merged
The cell at R3, C1 is not merged
The cell at R3, C2 is not merged
The cell at R3, C3 is not merged
The cell at R3, C4 is vertically merged
The cell at R3, C5 is not merged
The cell at R4, C1 is not merged
The cell at R4, C2 is not merged
The cell at R4, C3 is not merged
The cell at R4, C4 is vertically merged
The cell at R4, C5 is not merged
The cell at R5, C1 is not merged
The cell at R5, C2 is not merged
The cell at R5, C3 is not merged
The cell at R5, C4 is not merged
The cell at R5, C5 is not merged
Hi Jan,

Thanks for your inquiry.

The fact that 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 has 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.

In your case, I am afraid there is actually no bug here. Microsoft Word simply rewrites the table as having a wide cell after save instead of several merged cells. You can see this if you open up the internal document.xml found inside the DOCX file. Therefore the value that is loaded into Aspose.Words is correct. This behavior is a common occurrence and it's hard to know when or why Microsoft Word chooses to save cells in this way.

Hope this answers your query. Please let us know if you have any more queries.