本文整理了Java中org.apache.poi.xwpf.usermodel.XWPFDocument.getSection()
方法的一些代码示例,展示了XWPFDocument.getSection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWPFDocument.getSection()
方法的具体详情如下:
包路径:org.apache.poi.xwpf.usermodel.XWPFDocument
类名称:XWPFDocument
方法名:getSection
[英]Return the CTSectPr object that corresponds with the last section in this document.
[中]返回与本文档最后一节对应的CTSectPr对象。
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Create a footer of the given type
*
* @param type {@link HeaderFooterType} enum
* @return object of type {@link XWPFFooter}
*/
public XWPFFooter createFooter(HeaderFooterType type) {
XWPFHeaderFooterPolicy hfPolicy = createHeaderFooterPolicy();
// TODO this needs to be migrated out into section code
if (type == HeaderFooterType.FIRST) {
CTSectPr ctSectPr = getSection();
if (!ctSectPr.isSetTitlePg()) {
CTOnOff titlePg = ctSectPr.addNewTitlePg();
titlePg.setVal(STOnOff.ON);
}
// } else if (type == HeaderFooterType.EVEN) {
// TODO Add support for Even/Odd headings and footers
}
return hfPolicy.createFooter(STHdrFtr.Enum.forInt(type.toInt()));
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Create a header of the given type
*
* @param type {@link HeaderFooterType} enum
* @return object of type {@link XWPFHeader}
*/
public XWPFHeader createHeader(HeaderFooterType type) {
XWPFHeaderFooterPolicy hfPolicy = createHeaderFooterPolicy();
// TODO this needs to be migrated out into section code
if (type == HeaderFooterType.FIRST) {
CTSectPr ctSectPr = getSection();
if (!ctSectPr.isSetTitlePg()) {
CTOnOff titlePg = ctSectPr.addNewTitlePg();
titlePg.setVal(STOnOff.ON);
}
// } else if (type == HeaderFooterType.EVEN) {
// TODO Add support for Even/Odd headings and footers
}
return hfPolicy.createHeader(STHdrFtr.Enum.forInt(type.toInt()));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Create a header of the given type
*
* @param type {@link HeaderFooterType} enum
* @return object of type {@link XWPFHeader}
*/
public XWPFHeader createHeader(HeaderFooterType type) {
XWPFHeaderFooterPolicy hfPolicy = createHeaderFooterPolicy();
// TODO this needs to be migrated out into section code
if (type == HeaderFooterType.FIRST) {
CTSectPr ctSectPr = getSection();
if (!ctSectPr.isSetTitlePg()) {
CTOnOff titlePg = ctSectPr.addNewTitlePg();
titlePg.setVal(STOnOff.ON);
}
// } else if (type == HeaderFooterType.EVEN) {
// TODO Add support for Even/Odd headings and footers
}
return hfPolicy.createHeader(STHdrFtr.Enum.forInt(type.toInt()));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Create a footer of the given type
*
* @param type {@link HeaderFooterType} enum
* @return object of type {@link XWPFFooter}
*/
public XWPFFooter createFooter(HeaderFooterType type) {
XWPFHeaderFooterPolicy hfPolicy = createHeaderFooterPolicy();
// TODO this needs to be migrated out into section code
if (type == HeaderFooterType.FIRST) {
CTSectPr ctSectPr = getSection();
if (!ctSectPr.isSetTitlePg()) {
CTOnOff titlePg = ctSectPr.addNewTitlePg();
titlePg.setVal(STOnOff.ON);
}
// } else if (type == HeaderFooterType.EVEN) {
// TODO Add support for Even/Odd headings and footers
}
return hfPolicy.createFooter(STHdrFtr.Enum.forInt(type.toInt()));
}
内容来源于网络,如有侵权,请联系作者删除!