Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何进入Novacode Docx的下一页_C#_Novacode Docx - Fatal编程技术网

C# 如何进入Novacode Docx的下一页

C# 如何进入Novacode Docx的下一页,c#,novacode-docx,C#,Novacode Docx,我正在C#中使用Novacode DocX。使用方法InsertSectionPageBreak()。但它不会保存默认页面的参数。例如,页面应为横向格式。使用InsertSectionPageBreak()时,书籍的格式会更改。我需要的是,每个表已在每一页与横向格式 using (DocX doc = DocX.Create(fileName)) { doc.PageLayout.Orientation = Orientation.Landscape; var table =

我正在C#中使用Novacode DocX。使用方法
InsertSectionPageBreak()
。但它不会保存默认页面的参数。例如,页面应为横向格式。使用
InsertSectionPageBreak()
时,书籍的格式会更改。我需要的是,每个表已在每一页与横向格式

using (DocX doc = DocX.Create(fileName))
{
     doc.PageLayout.Orientation = Orientation.Landscape;
     var table = doc.AddTable(12, 2); 
     doc.InsertTable(table);
     doc.InsertSectionPageBreak();                           
}

不要使用
DocX
类的
InsertSectionPageBreak
方法,而是使用
表的
insertpagebreakafterf

doc.InsertTable(table).InsertPageBreakAfterSelf();

它应该保留上一页的样式。

欢迎!有代码显示吗?这将帮助我们帮助你。祝你好运使用分节符方法会导致后续节的页面大小恢复为“字母”。使用这种方法避免了这个问题。谢谢