Hello there,
I'm working with a WordDocument that will be converted to PDF once all the content is added.
Part of this content is related to table, and I used the WTable object (from DOCIO.DLS namespace).
Everything works great except that, if the page has not enough space for containing all the table content, then the table is splitted on two pages.
I tried to set the style options (please, note the instruction "tableStyle.TableProperties.AllowPageBreaks = false;")
{
string styleName = $"THeader_{Id}";
tableStyle = document.Styles.FindByName(styleName) as WTableStyle;
if (tableStyle == null)
{
tableStyle = document.AddTableStyle(styleName);
}
//Applies formatting for whole table.
tableStyle.CellProperties.Paddings.All = 5;
tableStyle.TableProperties.RowStripe = 1;
tableStyle.TableProperties.ColumnStripe = 1;
tableStyle.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center;
tableStyle.CharacterFormat.FontName = "Helvetica";
//Applies conditional formatting for first row.
ConditionalFormattingStyle firstRowStyle = tableStyle.ConditionalFormattingStyles.Add(ConditionalFormattingType.FirstRow);
firstRowStyle.CharacterFormat.Bold = true;
firstRowStyle.CharacterFormat.TextColor = Syncfusion.Drawing.Color.Black;
firstRowStyle.CellProperties.BackColor = Syncfusion.Drawing.Color.White;
tableStyle.TableProperties.AllowPageBreaks = false;
}
but the resulting PDF shows the following behavior:
Isn't it the right way to avoid a page break within a table? What am I missing?
Thanks in advance