We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Table head based on span

Hi,

I want to style the tables heading and body style based on the row & column spanning. If the table cell spanned with other, it should be style as Heading 1 (Inbuild style), otherwise list paragraph style.

Herewith, I have attached the input and output document for your reference.

Thanks in advance.



Hi Harish,


Thanks for your inquiry. 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. Please check following articles for more details:

Working with Merged Cells

Regarding setting style of paragraphs of cells, please use Paragraph.ParagraphFormat.StyleIdentifier property to set style identifier of the paragraph style applied to this formatting. Hope this helps you. Please let us know if you have any more queries.