Java Code Examples for org.docx4j.wml.ObjectFactory#createFtr()
The following examples show how to use
org.docx4j.wml.ObjectFactory#createFtr() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Docx4J_例子2.java From docx4j-template with Apache License 2.0 | 10 votes |
public Ftr getFtr(WordprocessingMLPackage wordprocessingMLPackage, ObjectFactory factory, Part sourcePart, boolean isUnderLine, String underLineSz) throws Exception { Ftr ftr = factory.createFtr(); File file = new File("f:/saveFile/tmp/xxt.jpg"); java.io.InputStream is = new java.io.FileInputStream(file); ftr.getContent().add( newImage(wordprocessingMLPackage, factory, sourcePart, BufferUtil.getBytesFromInputStream(is), "filename", "这是页脚", 1, 2, isUnderLine, underLineSz, JcEnumeration.CENTER)); if (isUnderLine) { ftr.getContent().add( createHeaderBlankP(wordprocessingMLPackage, factory, underLineSz, JcEnumeration.CENTER)); } return ftr; }
Example 2
Source File: Docx4J_简单例子2.java From docx4j-template with Apache License 2.0 | 6 votes |
public Ftr createFooterWithPageNr(ObjectFactory factory) { Ftr ftr = factory.createFtr(); P paragraph = factory.createP(); RPr fontRPr = getRPr(factory, "宋体", "000000", "20", STHint.EAST_ASIA, false, false, false, false); R run = factory.createR(); run.setRPr(fontRPr); paragraph.getContent().add(run); addPageTextField(factory, paragraph, "第"); addFieldBegin(factory, paragraph); addPageNumberField(factory, paragraph); addFieldEnd(factory, paragraph); addPageTextField(factory, paragraph, "页"); addPageTextField(factory, paragraph, " 总共"); addFieldBegin(factory, paragraph); addTotalPageNumberField(factory, paragraph); addFieldEnd(factory, paragraph); addPageTextField(factory, paragraph, "页"); setParagraphAlign(factory, paragraph, JcEnumeration.CENTER); ftr.getContent().add(paragraph); return ftr; }
Example 3
Source File: Docx4J_简单例子2.java From docx4j-template with Apache License 2.0 | 6 votes |
public Ftr getTextFtr(WordprocessingMLPackage wordprocessingMLPackage, ObjectFactory factory, Part sourcePart, String content, JcEnumeration jcEnumeration) throws Exception { Ftr ftr = factory.createFtr(); P footerP = factory.createP(); Text text = factory.createText(); text.setValue(content); R run = factory.createR(); run.getContent().add(text); footerP.getContent().add(run); PPr pPr = footerP.getPPr(); if (pPr == null) { pPr = factory.createPPr(); } Jc jc = pPr.getJc(); if (jc == null) { jc = new Jc(); } jc.setVal(jcEnumeration); pPr.setJc(jc); footerP.setPPr(pPr); ftr.getContent().add(footerP); return ftr; }
Example 4
Source File: Docx4J_简单例子.java From docx4j-template with Apache License 2.0 | 6 votes |
public Ftr createFooterWithPageNr(ObjectFactory factory) { Ftr ftr = factory.createFtr(); P paragraph = factory.createP(); RPr fontRPr = getRPr(factory, "宋体", "000000", "20", STHint.EAST_ASIA, false, false, false, false); R run = factory.createR(); run.setRPr(fontRPr); paragraph.getContent().add(run); addPageTextField(factory, paragraph, "第"); addFieldBegin(factory, paragraph); addPageNumberField(factory, paragraph); addFieldEnd(factory, paragraph); addPageTextField(factory, paragraph, "页"); addPageTextField(factory, paragraph, " 总共"); addFieldBegin(factory, paragraph); addTotalPageNumberField(factory, paragraph); addFieldEnd(factory, paragraph); addPageTextField(factory, paragraph, "页"); setParagraphAlign(factory, paragraph, JcEnumeration.CENTER); ftr.getContent().add(paragraph); return ftr; }
Example 5
Source File: Docx4J_简单例子.java From docx4j-template with Apache License 2.0 | 6 votes |
public Ftr getTextFtr(WordprocessingMLPackage wordprocessingMLPackage, ObjectFactory factory, Part sourcePart, String content, JcEnumeration jcEnumeration) throws Exception { Ftr ftr = factory.createFtr(); P footerP = factory.createP(); Text text = factory.createText(); text.setValue(content); R run = factory.createR(); run.getContent().add(text); footerP.getContent().add(run); PPr pPr = footerP.getPPr(); if (pPr == null) { pPr = factory.createPPr(); } Jc jc = pPr.getJc(); if (jc == null) { jc = new Jc(); } jc.setVal(jcEnumeration); pPr.setJc(jc); footerP.setPPr(pPr); ftr.getContent().add(footerP); return ftr; }
Example 6
Source File: Docx4J_简单例子2.java From docx4j-template with Apache License 2.0 | 5 votes |
public Ftr getFtr(WordprocessingMLPackage wordprocessingMLPackage, ObjectFactory factory, Part sourcePart) throws Exception { Ftr ftr = factory.createFtr(); File file = new File("f:/saveFile/tmp/xxt.jpg"); java.io.InputStream is = new java.io.FileInputStream(file); ftr.getContent().add( newImage(wordprocessingMLPackage, factory, sourcePart, BufferUtil.getBytesFromInputStream(is), "filename", "这是页脚", 1, 2, JcEnumeration.CENTER)); return ftr; }
Example 7
Source File: Docx4J_简单例子.java From docx4j-template with Apache License 2.0 | 5 votes |
public Ftr getFtr(WordprocessingMLPackage wordprocessingMLPackage, ObjectFactory factory, Part sourcePart) throws Exception { Ftr ftr = factory.createFtr(); File file = new File("f:/saveFile/tmp/xxt.jpg"); java.io.InputStream is = new java.io.FileInputStream(file); ftr.getContent().add( newImage(wordprocessingMLPackage, factory, sourcePart, BufferUtil.getBytesFromInputStream(is), "filename", "这是页脚", 1, 2, JcEnumeration.CENTER)); return ftr; }
Example 8
Source File: Docx4J_例子2.java From docx4j-template with Apache License 2.0 | 4 votes |
public Ftr createFooterWithPageNr( WordprocessingMLPackage wordprocessingMLPackage, ObjectFactory factory, boolean isUnderLine, String underLineSz, JcEnumeration jcEnumeration) throws Exception { Ftr ftr = factory.createFtr(); P paragraph = factory.createP(); RPr fontRPr = getRPr(factory, "宋体", "000000", "20", STHint.EAST_ASIA, false, false, false, false); R run = factory.createR(); run.setRPr(fontRPr); paragraph.getContent().add(run); addPageTextField(factory, paragraph, "第"); addFieldBegin(factory, paragraph); addPageNumberField(factory, paragraph); addFieldEnd(factory, paragraph); addPageTextField(factory, paragraph, "页"); addPageTextField(factory, paragraph, " 总共"); addFieldBegin(factory, paragraph); addTotalPageNumberField(factory, paragraph); addFieldEnd(factory, paragraph); addPageTextField(factory, paragraph, "页"); setParagraphSpacing(factory, paragraph, jcEnumeration, true, "0", "0", null, null, true, "240", STLineSpacingRule.AUTO); PPr pPr = paragraph.getPPr(); if (pPr == null) { pPr = factory.createPPr(); } Jc jc = pPr.getJc(); if (jc == null) { jc = new Jc(); } jc.setVal(jcEnumeration); pPr.setJc(jc); if (isUnderLine) { PBdr pBdr = pPr.getPBdr(); if (pBdr == null) { pBdr = factory.createPPrBasePBdr(); } CTBorder value = new CTBorder(); value.setVal(STBorder.SINGLE); value.setColor("000000"); value.setSpace(new BigInteger("0")); value.setSz(new BigInteger(underLineSz)); pBdr.setBetween(value); pPr.setPBdr(pBdr); paragraph.setPPr(pPr); } ftr.getContent().add(paragraph); if (isUnderLine) { ftr.getContent().add( createHeaderBlankP(wordprocessingMLPackage, factory, underLineSz, jcEnumeration)); } return ftr; }
Example 9
Source File: Docx4J_例子2.java From docx4j-template with Apache License 2.0 | 4 votes |
public Ftr getTextFtr(WordprocessingMLPackage wordprocessingMLPackage, ObjectFactory factory, Part sourcePart, String content, boolean isUnderLine, String underLineSz, JcEnumeration jcEnumeration) throws Exception { Ftr ftr = factory.createFtr(); P footerP = factory.createP(); Text text = factory.createText(); text.setValue(content); R run = factory.createR(); run.getContent().add(text); footerP.getContent().add(run); PPr pPr = footerP.getPPr(); if (pPr == null) { pPr = factory.createPPr(); } Jc jc = pPr.getJc(); if (jc == null) { jc = new Jc(); } jc.setVal(jcEnumeration); pPr.setJc(jc); footerP.setPPr(pPr); setParagraphSpacing(factory, footerP, jcEnumeration, true, "0", "0", null, null, true, "240", STLineSpacingRule.AUTO); if (isUnderLine) { PBdr pBdr = pPr.getPBdr(); if (pBdr == null) { pBdr = factory.createPPrBasePBdr(); } CTBorder value = new CTBorder(); value.setVal(STBorder.SINGLE); value.setColor("000000"); value.setSpace(new BigInteger("0")); value.setSz(new BigInteger(underLineSz)); pBdr.setBetween(value); pPr.setPBdr(pBdr); footerP.setPPr(pPr); } ftr.getContent().add(footerP); if (isUnderLine) { ftr.getContent().add( createHeaderBlankP(wordprocessingMLPackage, factory, underLineSz, jcEnumeration)); } return ftr; }