本文整理了Java中org.apache.poi.xwpf.usermodel.XWPFDocument.getBodyElements()
方法的一些代码示例,展示了XWPFDocument.getBodyElements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWPFDocument.getBodyElements()
方法的具体详情如下:
包路径:org.apache.poi.xwpf.usermodel.XWPFDocument
类名称:XWPFDocument
方法名:getBodyElements
[英]returns an Iterator with paragraphs and tables
[中]返回包含段落和表格的迭代器
代码示例来源:origin: org.apache.poi/poi-ooxml
public String getText() {
StringBuilder text = new StringBuilder(64);
XWPFHeaderFooterPolicy hfPolicy = document.getHeaderFooterPolicy();
// Start out with all headers
extractHeaders(text, hfPolicy);
// Process all body elements
for (IBodyElement e : document.getBodyElements()) {
appendBodyElementText(text, e);
text.append('\n');
}
// Finish up with all the footers
extractFooters(text, hfPolicy);
return text.toString();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
public String getText() {
StringBuilder text = new StringBuilder(64);
XWPFHeaderFooterPolicy hfPolicy = document.getHeaderFooterPolicy();
// Start out with all headers
extractHeaders(text, hfPolicy);
// Process all body elements
for (IBodyElement e : document.getBodyElements()) {
appendBodyElementText(text, e);
text.append('\n');
}
// Finish up with all the footers
extractFooters(text, hfPolicy);
return text.toString();
}
代码示例来源:origin: stackoverflow.com
private void passaElementi(XWPFDocument doc1){
for(IBodyElement e : doc1.getBodyElements()){
if(e instanceof XWPFParagraph){
XWPFParagraph p = (XWPFParagraph) e;
if(p.getCTP().getPPr()!=null && p.getCTP().getPPr().getSectPr()!=null){
continue;
}else{
document.createParagraph();
document.setParagraph(p, i);
i++;
}
}else if(e instanceof XWPFTable){
XWPFTable t = (XWPFTable)e;
document.createTable();
document.setTable(j, t);
j++;
}else if(e instanceof XWPFSDT){
// boh!
}
}
}
代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter
/**
* Create a pdf version of the document, using XSL FO.
*
* @param wmlStyles
* @param wmlDocument
* @param os The OutputStream to write the pdf to
*/
public void output( OutputStream os )
throws Exception
{
try
{
// body.get
List<IBodyElement> bodyElement = document.getBodyElements();
for ( IBodyElement iBodyElement : bodyElement )
{
visit( iBodyElement );
}
}
catch ( Exception e )
{
e.printStackTrace();
throw new Exception( "iTextissues", e );
}
finally
{
// Flush
writer.save( os );
}
}
代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core-gae
/**
* Main entry for visit XWPFDocument.
*
* @param out
* @throws Exception
*/
public void start()
throws Exception
{
// start document
T container = startVisitDocument();
// Create IText, XHTML element for each XWPF elements from the w:body
List<IBodyElement> bodyElements = document.getBodyElements();
visitBodyElements( bodyElements, container );
// end document
endVisitDocument();
}
代码示例来源:origin: com.github.livesense/org.liveSense.framework.xdocreport
/**
* Main entry for visit XWPFDocument.
*
* @param out
* @throws Exception
*/
public void start()
throws Exception
{
// start document
T container = startVisitDocument();
// Create IText, XHTML element for each XWPF elements from the w:body
List<IBodyElement> bodyElements = document.getBodyElements();
visitBodyElements( bodyElements, container );
// end document
endVisitDocument();
}
代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core
/**
* Main entry for visit XWPFDocument.
*
* @param out
* @throws Exception
*/
public void start()
throws Exception
{
// start document
T container = startVisitDocument();
// Create IText, XHTML element for each XWPF elements from the w:body
List<IBodyElement> bodyElements = document.getBodyElements();
visitBodyElements( bodyElements, container );
// end document
endVisitDocument();
}
代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter
private Stack<CTSectPr> getSectPrStack()
{
if ( sectPrStack != null )
{
return sectPrStack;
}
sectPrStack = new Stack<CTSectPr>();
for ( IBodyElement bodyElement : document.getBodyElements() )
{
if ( bodyElement.getElementType() == BodyElementType.PARAGRAPH )
{
CTPPr ppr = ( (XWPFParagraph) bodyElement ).getCTP().getPPr();
if ( ppr != null )
{
CTSectPr sectPr = ppr.getSectPr();
if ( sectPr != null )
{
sectPrStack.push( sectPr );
}
}
}
}
return sectPrStack;
}
代码示例来源:origin: stackoverflow.com
XWPFParagraph imageParagraph = null;
List<IBodyElement> documentElements = document.getBodyElements();
for(IBodyElement documentElement : documentElements){
imageParagraphPos ++;
document.removeBodyElement(document.getBodyElements().size() - 1);
代码示例来源:origin: stackoverflow.com
sdts.addAll(extractSDTsFromBodyElements(header.getBodyElements()));
sdts.addAll(extractSDTsFromBodyElements(doc.getBodyElements()));
代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter
/**
* Main entry for visit XWPFDocument.
*
* @param out
* @throws Exception
*/
public void visit( OutputStream out )
throws Exception
{
T container = startVisitDocument( out );
// Create Header/Footer
CTSectPr sectPr = document.getDocument().getBody().getSectPr();
visitHeadersFooters( sectPr, container );
// Create IText element for each XWPF elements from the w:body
List<IBodyElement> bodyElements = document.getBodyElements();
visitBodyElements( bodyElements, container );
// Save
// Clean-up
endVisitDocument();
out.close();
}
代码示例来源:origin: stackoverflow.com
for (IBodyElement bodyElement : doc.getBodyElements()) {
内容来源于网络,如有侵权,请联系作者删除!