Tightly formatted table with vertical merge cells and page break issues

I’m currently using OOXML to take a template word document containing a highly formatted table (header, and four example/template rows.) It is working very well, with the exception of the intended row groupings breaking across pages.

I have a table that is defined as having an upper and lower row. The lower row is designated as the header to repeat on each page. Header row has a sub table with three formatted rows. This is working perfectly (specified borders, fonts and cell/column widths.)

The lower main row contains a sub table that contains the data I write from a DataRow[] collection. This is formatted to match the column widths of the above header row/table. It is outputting perfectly with one exception. The left most column is the major grouping (vertically merged, can break pages.) The next column to the right is the sub grouping (cell vertically merged across sub group child rows), and should not break across pages. The remaining five columns are individual line items that go with the sub grouping.

I’ve been playing with various incarnations of the paragraph line/page break settings and the table break row across pages settings with no luck. The sub group rows are still breaking across pages.

I’m not certain if this is short coming in the ooxml library, my frustration with the complexity of it (which I’m investigating if Aspose.Words would assist with) or it if just isn’t possible with Word and tables with vertically merged cells.

Would Aspose.Words be capable of outputting a Word document with such a table that wouldn’t break across row sub groups?

Hi Travis,

Thanks for your interest in Aspose.Words. Please refer to the following section of documentation which outlines how to keep Tables and Rows from breaking across Pages. I hope, this helps.
https://docs.aspose.com/words/net/working-with-columns-and-rows/

In case the problem still remains, please attach the following resources here for testing:

  • Your input Word document.
  • Your expected Word document which shows the correct result. Please create this document using Microsoft Word for our reference.

As soon as you get these pieces of information ready, we’ll start investigation into your issues and provide you code to achieve the same expected result using Aspose.Words.

Best regards,

I haven’t been able to create a “correct” version yet (and perhaps that is because it simply isn’t possible.)

Attached you’ll find a sample of what I’m referring to (sub group parent row breaking across two pages.) Note, I shortened the page just to illustrate the example (my actual implementation is a normal 8.5x11)

The row containing “Overall”, “13”… should be with it’s parent “Group Heading 3”.

Does that make sense? Is that possible at all in Word, and specifically with the latest .Net version of Aspose.Words?

Hi Travis,

Thanks for your inquiry. I am afraid, I couldn’t find a straight forward way to achieve this. However, you can determine if the starting and ending rows belonging to a group are both contained inside the same page. If they are not, you can either start increasing the page height or decreasing the font size of text of all group rows until the last row of group is pushed up to the previous page. Please see LayoutCollector class members.

Best regards,