I am using OpenXML to generate a word document which contains thousands of tables. Some of them span over the length of entire page, which is fine as there is no way to prevent
While this may have worked for you, it did not solve the problem for me. We were looking for the properties that results in "Allow row to break across pages". After some additional digging, the follow was discovered (example in context with the other answers example code).
DocumentFormat.OpenXml.Wordprocessing.TableRowProperties and
DocumentFormat.OpenXml.Wordprocessing.CantSplit (Table Row Cannot Break Across Pages)
new Table(
new TableProperties(
new TableStyle() { Val = "TableGrid" },
new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto }),
new TableGrid(
new GridColumn() { Width = "2000" },
new GridColumn() { Width = "2000" },
new GridColumn() { Width = "2000" },
new GridColumn() { Width = "2000" }),
new TableRow(
new TableRowProperties(
new CantSplit()),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 1")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 1")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 1")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 1"))))),
new TableRow(
new TableRowProperties(
new CantSplit()),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 2")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 2")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 2")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 2"))))),
new TableRow(
new TableRowProperties(
new CantSplit()),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 3")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 3")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 3")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 3"))))),
new TableRow(
new TableRowProperties(
new CantSplit()),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 4")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 4")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 4")))),
new TableCell(
new Paragraph(
new Run(
new Text("Table Row 4"))))))));
Reference: http://msdn.microsoft.com/EN-US/library/office/documentformat.openxml.wordprocessing.cantsplit(v=office.15).aspx
P.S. @mcdonams - Like your alive avatar!
Edit: Sorry I had misread this question from the start.