【发布时间】:2013-02-05 16:39:24
【问题描述】:
我需要为文档的某些页面设置横向。我试过这段代码:
SectPr sectionLandscape = objectFactory.createSectPr();
String rsidR = sectionLandscape.getRsidR();
SectPr sectionPortrait = objectFactory.createSectPr();
sectionPortrait.setRsidR(rsidR);
sectionPortrait.setRsidSect(rsidR);
PgSz landscape = new PgSz();
landscape.setOrient(STPageOrientation.LANDSCAPE);
landscape.setH(BigInteger.valueOf(11906));
landscape.setW(BigInteger.valueOf(16383));
sectionLandscape.setPgSz(landscape);
mdp.addObject(sectionLandscape);
它创建这个 xml 代码:
<w:sectPr>
<w:pgSz w:w="16383" w:orient="landscape" w:h="11906"/>
</w:sectPr>
Section 标记之后有我在横向页面中需要的文本和表格。在 Word 2007/2010 中,我只能看到纵向页面,在页面的编辑模式下,我可以看到选择为横向的页面。
【问题讨论】:
-
不需要 rsId 的东西。
标签: docx4j