参考资料:http://stackoverflow.com/questions/17787176/spacing-and-margin-settings-in-word-document-using-apache-poi-docx

CTSectPr sectPr = document.getDocument().getBody().addNewSectPr();
CTPageMar pageMar = sectPr.addNewPgMar();
pageMar.setLeft(BigInteger.valueOf(720L));
pageMar.setTop(BigInteger.valueOf(1440L));
pageMar.setRight(BigInteger.valueOf(720L));
pageMar.setBottom(BigInteger.valueOf(1440L))

在导入org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPageMar类的时候可能
找不到引用的jar包,提示“The type org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPageMar cannot be resolved

解决办法参考http://stackoverflow.com/questions/10208097/how-to-copy-a-paragraph-of-docx-to-another-docx-withjava-and-retain-the-style

下载ooxml-schemas 1.1 http://repo.maven.apache.org/maven2/org/apache/poi/ooxml-schemas/1.1/

POI 3.8、POI3.9、POI3.10.1和POI 3.11的jar包中都不包含CTPageMar这个类


其他常用的一些样式设置可以参考http://53873039oycg.iteye.com/blog/2153194

相关文章:

  • 2021-12-02
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2022-03-06
猜你喜欢
  • 2021-08-31
  • 2022-02-18
  • 2021-09-01
  • 2022-01-14
  • 2022-01-24
  • 2023-02-22
  • 2022-12-23
相关资源
相似解决方案