本文整理了Java中org.apache.poi.xwpf.usermodel.XWPFDocument.getDocument()
方法的一些代码示例,展示了XWPFDocument.getDocument()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWPFDocument.getDocument()
方法的具体详情如下:
包路径:org.apache.poi.xwpf.usermodel.XWPFDocument
类名称:XWPFDocument
方法名:getDocument
[英]Returns the low level document base object
[中]返回低级文档基对象
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
*
*/
public void createTOC() {
CTSdtBlock block = this.getDocument().getBody().addNewSdt();
TOC toc = new TOC(block);
for (XWPFParagraph par : paragraphs) {
String parStyle = par.getStyle();
if (parStyle != null && parStyle.startsWith("Heading")) {
try {
int level = Integer.parseInt(parStyle.substring("Heading".length()));
toc.addRow(level, par.getText(), 1, "112723803");
} catch (NumberFormatException e) {
LOG.log(POILogger.ERROR, "can't format number in TOC heading", e);
}
}
}
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Return the {@link CTSectPr} object that corresponds with the
* last section in this document.
*
* @return {@link CTSectPr} object
*/
private CTSectPr getSection() {
CTBody ctBody = getDocument().getBody();
return (ctBody.isSetSectPr() ?
ctBody.getSectPr() :
ctBody.addNewSectPr());
}
代码示例来源:origin: org.apache.poi/poi-ooxml
private void setFooterReference(Enum type, XWPFHeaderFooter wrapper) {
CTHdrFtrRef ref = doc.getDocument().getBody().getSectPr().addNewFooterReference();
ref.setType(type);
ref.setId(doc.getRelationId(wrapper));
}
代码示例来源:origin: org.apache.poi/poi-ooxml
private void setHeaderReference(Enum type, XWPFHeaderFooter wrapper) {
CTHdrFtrRef ref = doc.getDocument().getBody().getSectPr().addNewHeaderReference();
ref.setType(type);
ref.setId(doc.getRelationId(wrapper));
}
代码示例来源:origin: org.apache.poi/poi-ooxml
CTBody ctBody = doc.getDocument().getBody();
sectPr = ctBody.isSetSectPr()
? ctBody.getSectPr()
代码示例来源:origin: org.apache.poi/poi-ooxml
private XWPFParagraph getWatermarkParagraph(String text, int idx) {
CTP p = CTP.Factory.newInstance();
byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR();
byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault();
p.setRsidP(rsidr);
p.setRsidRDefault(rsidrdefault);
代码示例来源:origin: stackoverflow.com
XWPFDocument doc = new XWPFDocument(OPCPackage.open("test.docx"));
if (doc.getDocument().getBackground() == null) {
doc.getDocument.addNewBackground();
};
CTBackground bkgnd = doc.getDocument().getBackground();
bkgnd.setColor("FFFFFF");
代码示例来源:origin: youseries/ureport
XWPFDocument document = new XWPFDocument();
try{
CTSectPr sectpr = document.getDocument().getBody().addNewSectPr();
if(!sectpr.isSetPgSz()) {
sectpr.addNewPgSz();
代码示例来源:origin: stackoverflow.com
XWPFDocument doc = new XWPFDocument();
CTSectPr sectPr = doc.getDocument().getBody().addNewSectPr();
CTPageMar pageMar = sectPr.addNewPgMar();
pageMar.setLeft(BigInteger.valueOf(1500L));
pageMar.setRight(BigInteger.valueOf(1500L));
pageMar.setTop(BigInteger.valueOf(2000L));
pageMar.setBottom(BigInteger.valueOf(1000L));
代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core
public XWPFDocumentVisitor( XWPFDocument document, O options )
throws Exception
{
this.document = document;
this.options = options;
this.stylesDocument = createStylesDocument( document );
this.masterPageManager = new MasterPageManager( document.getDocument(), this );
}
代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core-gae
public XWPFDocumentVisitor( XWPFDocument document, O options )
throws Exception
{
this.document = document;
this.options = options;
this.stylesDocument = createStylesDocument( document );
this.masterPageManager = new MasterPageManager( document.getDocument(), this );
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Figures out the policy for the given document,
* and creates any header and footer objects
* as required.
*/
public XWPFHeaderFooterPolicy(XWPFDocument doc) throws IOException, XmlException {
this(doc, doc.getDocument().getBody().getSectPr());
}
代码示例来源:origin: com.github.livesense/org.liveSense.framework.xdocreport
public XWPFDocumentVisitor( XWPFDocument document, O options )
throws Exception
{
this.document = document;
this.options = options;
this.stylesDocument = createStylesDocument( document );
this.masterPageManager = new MasterPageManager( document.getDocument(), this );
}
代码示例来源: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: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Return the {@link CTSectPr} object that corresponds with the
* last section in this document.
*
* @return {@link CTSectPr} object
*/
private CTSectPr getSection() {
CTBody ctBody = getDocument().getBody();
return (ctBody.isSetSectPr() ?
ctBody.getSectPr() :
ctBody.addNewSectPr());
}
代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter
@Override
protected IITextContainer startVisitDocument( OutputStream out )
throws Exception
{
// Create instance of PDF document
styleEngine = new StyleEngineForIText( document, options );
pdfDocument = new StylableDocument( out, styleEngine );
CTSectPr sectPr = document.getDocument().getBody().getSectPr();
applySectPr( sectPr );
return pdfDocument;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
private void setHeaderReference(Enum type, XWPFHeaderFooter wrapper) {
CTHdrFtrRef ref = doc.getDocument().getBody().getSectPr().addNewHeaderReference();
ref.setType(type);
ref.setId(doc.getRelationId(wrapper));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
private void setFooterReference(Enum type, XWPFHeaderFooter wrapper) {
CTHdrFtrRef ref = doc.getDocument().getBody().getSectPr().addNewFooterReference();
ref.setType(type);
ref.setId(doc.getRelationId(wrapper));
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
private void setFooterReference(Enum type, XWPFHeaderFooter wrapper) {
CTHdrFtrRef ref = doc.getDocument().getBody().getSectPr().addNewFooterReference();
ref.setType(type);
ref.setId(wrapper.getPackageRelationship().getId());
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
private void setHeaderReference(Enum type, XWPFHeaderFooter wrapper) {
CTHdrFtrRef ref = doc.getDocument().getBody().getSectPr().addNewHeaderReference();
ref.setType(type);
ref.setId(wrapper.getPackageRelationship().getId());
}
内容来源于网络,如有侵权,请联系作者删除!