解决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();
}

posted @ 2025-09-15 18:39  七君子风  阅读(6)  评论(0)    收藏  举报