本文整理了Java中org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy.createFooter()
方法的一些代码示例,展示了XWPFHeaderFooterPolicy.createFooter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWPFHeaderFooterPolicy.createFooter()
方法的具体详情如下:
包路径:org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy
类名称:XWPFHeaderFooterPolicy
方法名:createFooter
[英]Creates an empty footer of the specified type, containing a single empty paragraph, to which you can then set text, add more paragraphs etc.
[中]创建指定类型的空页脚,其中包含一个空段落,然后可以在其中设置文本、添加更多段落等。
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Creates an empty footer of the specified type, containing a single
* empty paragraph, to which you can then set text, add more paragraphs etc.
*/
public XWPFFooter createFooter(Enum type) {
return createFooter(type, null);
}
代码示例来源: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: youseries/ureport
public void build(XWPFDocument document,CTSectPr sectPr,Report report){
//HeaderFooterDefinition headerDef=report.getHeader();
//HeaderFooterDefinition footerDef=report.getFooter();
HeaderFooter header=new HeaderFooter();
HeaderFooter footer=new HeaderFooter();
XWPFHeaderFooterPolicy headerFooterPolicy=null;
if(header!=null){
List<XWPFParagraph> list=buildXWPFParagraph(header, document);
XWPFParagraph[] newparagraphs = new XWPFParagraph[list.size()];
list.toArray(newparagraphs);
headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
headerFooterPolicy.createHeader(STHdrFtr.DEFAULT, newparagraphs);
}
if(footer!=null){
List<XWPFParagraph> list=buildXWPFParagraph(footer, document);
XWPFParagraph[] newparagraphs = new XWPFParagraph[list.size()];
list.toArray(newparagraphs);
/*if(headerFooterPolicy==null){
headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
}*/
headerFooterPolicy.createFooter(STHdrFtr.DEFAULT, newparagraphs);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Creates an empty footer of the specified type, containing a single
* empty paragraph, to which you can then set text, add more paragraphs etc.
*/
public XWPFFooter createFooter(Enum type) {
return createFooter(type, null);
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
public XWPFFooter createFooter(Enum type) throws IOException {
return createFooter(type, null);
}
代码示例来源:origin: stackoverflow.com
CTP ctp = CTP.Factory.newInstance();
CTR ctr = ctp.addNewR();
CTRPr rpr = ctr.addNewRPr();
CTText textt = ctr.addNewT();
textt.setStringValue( " Page 1" );
XWPFParagraph codePara = new XWPFParagraph( ctp, document );
XWPFParagraph[] newparagraphs = new XWPFParagraph[1];
newparagraphs[0] = codePara;
CTSectPr sectPr = document.getDocument().getBody().addNewSectPr();
XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy( document, sectPr );
headerFooterPolicy.createFooter( STHdrFtr.DEFAULT, newparagraphs );
代码示例来源:origin: stackoverflow.com
String text = "Test";
File docxFile = new File("C:/testeXWPF.docx");
FileInputStream finStream = new FileInputStream(docxFile.getAbsolutePath());
XWPFDocument doc = new XWPFDocument(finStream);
XWPFHeaderFooterPolicy policy = doc.getHeaderFooterPolicy();
if (policy == null) {
policy = new XWPFHeaderFooterPolicy(doc);
}
CTP ctP1 = CTP.Factory.newInstance();
CTR ctR1 = ctP1.addNewR();
CTText t = ctR1.addNewT();
t.setStringValue(text);
XWPFParagraph codePara = new XWPFParagraph(ctP1);
XWPFParagraph[] newparagraphs = new XWPFParagraph[1];
newparagraphs[0] = codePara;
policy.createFooter(policy.DEFAULT, newparagraphs);
FileOutputStream fileOut = new FileOutputStream(docxFile);
doc.write(fileOut);
fileOut.close();
代码示例来源:origin: stackoverflow.com
XWPFDocument document = new XWPFDocument();
CTP ctp = CTP.Factory.newInstance();
CTR ctr = ctp.addNewR();
CTRPr rpr = ctr.addNewRPr();
CTText textt = ctr.addNewT();
textt.setStringValue( " Page 1" );
XWPFParagraph codePara = new XWPFParagraph( ctp, document );
XWPFParagraph[] newparagraphs = new XWPFParagraph[1];
newparagraphs[0] = codePara;
CTSectPr sectPr = document.getDocument().getBody().addNewSectPr();
XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy( document, sectPr );
headerFooterPolicy.createFooter( STHdrFtr.DEFAULT, newparagraphs );
代码示例来源:origin: com.bstek.ureport/ureport2-core
public void build(XWPFDocument document,CTSectPr sectPr,Report report){
//HeaderFooterDefinition headerDef=report.getHeader();
//HeaderFooterDefinition footerDef=report.getFooter();
HeaderFooter header=new HeaderFooter();
HeaderFooter footer=new HeaderFooter();
XWPFHeaderFooterPolicy headerFooterPolicy=null;
if(header!=null){
List<XWPFParagraph> list=buildXWPFParagraph(header, document);
XWPFParagraph[] newparagraphs = new XWPFParagraph[list.size()];
list.toArray(newparagraphs);
headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
headerFooterPolicy.createHeader(STHdrFtr.DEFAULT, newparagraphs);
}
if(footer!=null){
List<XWPFParagraph> list=buildXWPFParagraph(footer, document);
XWPFParagraph[] newparagraphs = new XWPFParagraph[list.size()];
list.toArray(newparagraphs);
/*if(headerFooterPolicy==null){
headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
}*/
headerFooterPolicy.createFooter(STHdrFtr.DEFAULT, newparagraphs);
}
}
代码示例来源:origin: stackoverflow.com
// create footer components
XWPFDocument document = new XWPFDocument();
CTP footerCtp = CTP.Factory.newInstance();
CTR footerCtr = footerCtp.addNewR();
XWPFParagraph footerCopyrightParagraph = new XWPFParagraph(footerCtp, document);
document.getProperties().getExtendedProperties().getUnderlyingProperties().getPages();
XWPFRun run = footerCopyrightParagraph.getRun(footerCtr);
run.setText("My Website.com");
run.addTab();
run.setText("\u00A9" + " My Website - " + Calendar.getInstance().get(Calendar.YEAR));
run.addTab();
run.setText("Right Side Text");
setTabStop(footerCtp, STTabJc.Enum.forString("right"), BigInteger.valueOf(9000));
XWPFParagraph[] footerParagraphs = {footerCopyrightParagraph};
CTSectPr sectPr = document.getDocument().getBody().addNewSectPr();
XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
headerFooterPolicy.createFooter(STHdrFtr.DEFAULT, footerParagraphs);
代码示例来源: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()));
}
代码示例来源:origin: org.apache.poi/poi-examples
t.setStringValue("My Footer");
pars[0] = new XWPFParagraph(ctP, doc);
hfPolicy.createFooter(XWPFHeaderFooterPolicy.DEFAULT, pars);
代码示例来源:origin: stackoverflow.com
XWPFFooter footer = headerFooterPolicy.createFooter(XWPFHeaderFooterPolicy.DEFAULT);
代码示例来源:origin: stackoverflow.com
XWPFFooter footer = headerFooterPolicy.createFooter(XWPFHeaderFooterPolicy.DEFAULT);
内容来源于网络,如有侵权,请联系作者删除!