How to go to the next page in Novacode Docx

I am using Novacode DocX in C #. Using the method InsertSectionPageBreak(). But it does not save the default page settings. For example, the page should be in landscape format. When used, the InsertSectionPageBreak()format changes in the book. I need each table to be on every page in landscape format.

using (DocX doc = DocX.Create(fileName))
{
     doc.PageLayout.Orientation = Orientation.Landscape;
     var table = doc.AddTable(12, 2); 
     doc.InsertTable(table);
     doc.InsertSectionPageBreak();                           
}
+4
source share
1 answer

Instead of using a InsertSectionPageBreakclass method , DocXuse a InsertPageBreakAfterSelfclass Table.

doc.InsertTable(table).InsertPageBreakAfterSelf();

It should keep the style on the previous page.

+6
source

Source: https://habr.com/ru/post/1626816/


All Articles