本文整理了Java中org.apache.poi.xwpf.usermodel.XWPFDocument.<init>()
方法的一些代码示例,展示了XWPFDocument.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWPFDocument.<init>()
方法的具体详情如下:
包路径:org.apache.poi.xwpf.usermodel.XWPFDocument
类名称:XWPFDocument
方法名:<init>
暂无
代码示例来源:origin: looly/hutool
public Word07Writer() {
this(new XWPFDocument());
}
代码示例来源:origin: looly/hutool
public Word07Writer() {
this(new XWPFDocument());
}
代码示例来源:origin: org.apache.poi/poi-ooxml
public XWPFWordExtractor(OPCPackage container) throws XmlException, OpenXML4JException, IOException {
this(new XWPFDocument(container));
}
代码示例来源:origin: looly/hutool
/**
* 创建{@link XWPFDocument},如果文件已存在则读取之,否则创建新的
*
* @param file docx文件
* @return {@link XWPFDocument}
*/
public static XWPFDocument create(File file) {
try {
return FileUtil.exist(file) ? new XWPFDocument(OPCPackage.open(file)) : new XWPFDocument();
} catch (InvalidFormatException e) {
throw new POIException(e);
} catch (IOException e) {
throw new IORuntimeException(e);
}
}
}
代码示例来源:origin: looly/hutool
/**
* 创建{@link XWPFDocument},如果文件已存在则读取之,否则创建新的
*
* @param file docx文件
* @return {@link XWPFDocument}
*/
public static XWPFDocument create(File file) {
try {
return FileUtil.exist(file) ? new XWPFDocument(OPCPackage.open(file)) : new XWPFDocument();
} catch (InvalidFormatException e) {
throw new POIException(e);
} catch (IOException e) {
throw new IORuntimeException(e);
}
}
}
代码示例来源:origin: stackoverflow.com
XWPFDocument document = new XWPFDocument();
XWPFParagraph tmpParagraph = document.createParagraph();
XWPFRun tmpRun = tmpParagraph.createRun();
tmpRun.setText("LALALALAALALAAAA");
tmpRun.setFontSize(18);
document.write(new FileOutputStream(new File("yourpathhere")));
document.close();
代码示例来源:origin: stackoverflow.com
XWPFDocument document = new XWPFDocument(new FileInputStream("template.docx");
paragraph = document.createParagraph();
paragraph.setStyle("Heading1");
代码示例来源:origin: zhangyd-c/springboot-learning
public static void buildXssf(File tmpFile, Map<String, Object> contentMap, String exportFile) throws Exception {
FileInputStream tempFileInputStream = new FileInputStream(tmpFile);
XWPFDocument document = new XWPFDocument(tempFileInputStream);
// 替换段落里面的变量
replaceInPara(document, contentMap);
// 导出到文件
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
document.write(byteArrayOutputStream);
write(exportFile, byteArrayOutputStream);
document.close();
}
代码示例来源:origin: org.exoplatform.core/exo.core.component.document
public XWPFDocument run() throws Exception
{
return new XWPFDocument(is);
}
});
代码示例来源:origin: org.exoplatform.core/exo.core.component.document
public XWPFDocument run() throws Exception
{
return new XWPFDocument(is);
}
}));
代码示例来源:origin: stackoverflow.com
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
[...]
XWPFDocument docx = new XWPFDocument(new FileInputStream("file.docx"));
XWPFWordExtractor we = new XWPFWordExtractor(docx);
System.out.println(we.getText());
代码示例来源:origin: youseries/ureport
@Override
public void produce(Report report,OutputStream outputStream) {
XWPFDocument document = new XWPFDocument();
try{
CTSectPr sectpr = document.getDocument().getBody().addNewSectPr();
代码示例来源:origin: stackoverflow.com
XWPFDocument doc = new XWPFDocument();
doc.write(new FileOutputStream(new File("test.docx")));
CustomXWPFDocument document = new CustomXWPFDocument(new FileInputStream(new File("test.docx")));
FileOutputStream fos = new FileOutputStream(new File("test.docx"));
String blipId = document.addPictureData(new FileInputStream(new File("res/Tulips.jpg")), Document.PICTURE_TYPE_JPEG);
System.out.println(document.getNextPicNameNumber(Document.PICTURE_TYPE_JPEG));
//System.out.println(document.getNextPicNameNumber(Document.PICTURE_TYPE_JPEG));
document.createPicture(blipId,document.getNextPicNameNumber(Document.PICTURE_TYPE_JPEG), 100, 150);
document.write(fos);
fos.flush();
fos.close();
代码示例来源:origin: stackoverflow.com
InputStream fis = new FileInputStream(...);
POITextExtractor extractor;
// if docx
if (fileName.toLowerCase().endsWith(".docx")) {
XWPFDocument doc = new XWPFDocument(fis);
extractor = new XWPFWordExtractor(doc);
} else {
// if doc
POIFSFileSystem fileSystem = new POIFSFileSystem(fis);
extractor = ExtractorFactory.createExtractor(fileSystem);
}
String extractedText = extractor.getText();
代码示例来源:origin: stackoverflow.com
InputStream in = new FileInputStream(f);
XWPFDocument doc = new XWPFDocument(in);
for (PackagePart p : doc.getAllEmbedds()) {
POIFSFileSystem poifs = new POIFSFileSystem(p.getInputStream());
byte[] oleData = IOUtils.toByteArray(
poifs.createDocumentInputStream("Equation Native"));
}
代码示例来源:origin: org.isisaddons.module.xdocreport/isis-module-xdocreport-dom
private byte[] toPdf(final byte[] docxBytes) throws IOException {
XWPFDocument document = new XWPFDocument(new ByteArrayInputStream(docxBytes));
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfConverter.getInstance().convert(document, baos, pdfOptions);
return baos.toByteArray();
}
代码示例来源:origin: fr.opensagres/fr.opensagres.xdocreport.converter.docx.xwpf
public void convert(InputStream in, OutputStream out, Options options)
throws XDocConverterException {
try {
XWPFDocument document = new XWPFDocument(in);
org.apache.poi.xwpf.converter.xhtml.XWPF2XHTMLConverter
.getInstance().convert(document, out, toXWPFOptions(options));
} catch (Exception e) {
LOGGER.severe(e.getMessage());
throw new XDocConverterException(e);
}
}
代码示例来源:origin: stackoverflow.com
XWPFDocument template = new XWPFDocument(new FileInputStream(new File("Template.dotx")));
XWPFDocument doc = new XWPFDocument();
// let's copy styles from template to new doc
XWPFStyles newStyles = doc.createStyles();
newStyles.setStyles(template.getStyle());
XWPFParagraph para = doc.createParagraph();
para.setStyle("Heading1");
XWPFRun run = para.createRun();
run.setText("Heading 1");
return doc;
代码示例来源: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: yeokm1/docs-to-pdf-converter
@Override
public void convert() throws Exception {
loading();
XWPFDocument document = new XWPFDocument(inStream);
PdfOptions options = PdfOptions.create();
processing();
PdfConverter.getInstance().convert(document, outStream, options);
finished();
}
内容来源于网络,如有侵权,请联系作者删除!