解决c# DocX生成的word文档wps打开排版外边距错乱微软office正常问题

解决c# DocX生成的word文档wps打开排版外边距错乱微软office正常问题

public void insertBreak(DocX document, String filename)
{
DocX tempDocx = DocX.Create(filename);
setPageMargin(tempDocx);
document.InsertDocument(tempDocx);
document.InsertSectionPageBreak(true);

}

 

改为

 

public void insertBreak(DocX document, String filename)
{
DocX tempDocx = DocX.Create(filename);
setPageMargin(tempDocx);
document.InsertDocument(tempDocx);
//document.InsertSectionPageBreak(true);
Paragraph p = document.InsertParagraph();
p.InsertPageBreakAfterSelf();
}