本文整理了Java中org.apache.poi.xwpf.usermodel.XWPFDocument.close()
方法的一些代码示例,展示了XWPFDocument.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWPFDocument.close()
方法的具体详情如下:
包路径:org.apache.poi.xwpf.usermodel.XWPFDocument
类名称:XWPFDocument
方法名:close
暂无
代码示例来源: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: 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: youseries/ureport
}finally{
try{
document.close();
}catch(Exception ex){
ex.printStackTrace();
代码示例来源:origin: stackoverflow.com
final XWPFDocument docx = new XWPFDocument(new FileInputStream(new File(inFileNameString)));
final FileOutputStream out = new FileOutputStream(outFileNameString); docx.write(out);
out.close();
docx.close();
代码示例来源:origin: ekoz/kbase-doc
@Override
public byte[] handle(File originFile, String watermark, String color) throws IOException {
watermark = StringUtils.isBlank(watermark)?DEFAULT_WATERMARK:watermark;
color = StringUtils.isBlank(color)?DEFAULT_FONT_COLOR:color;
if (originFile.getName().toLowerCase().endsWith("docx")) {
try (InputStream in = new FileInputStream(originFile)){
XWPFDocument doc = new XWPFDocument(in);
addWaterMark(doc, watermark, color);
try (OutputStream out = new FileOutputStream(originFile)){
doc.write(out);
doc.close();
}
}
return IOUtils.toByteArray(new FileInputStream(originFile));
} else if (originFile.getName().toLowerCase().endsWith("doc")) {
try (InputStream in = new FileInputStream(originFile)){
HWPFDocument doc = new HWPFDocument(in);
addWaterMark(doc, watermark, color);
try (OutputStream out = new FileOutputStream(originFile)){
doc.write(out);
doc.close();
}
}
return IOUtils.toByteArray(new FileInputStream(originFile));
}
return null;
}
代码示例来源:origin: stackoverflow.com
public void test1() throws IOException{
XWPFDocument sampleDoc = new XWPFDocument();
XWPFHeaderFooterPolicy policy = sampleDoc.getHeaderFooterPolicy();
//in an empty document always will be null
if(policy==null){
CTSectPr sectPr = sampleDoc.getDocument().getBody().addNewSectPr();
policy = new XWPFHeaderFooterPolicy( sampleDoc, sectPr );
}
if (policy.getDefaultHeader() == null && policy.getFirstPageHeader() == null
&& policy.getDefaultFooter() == null) {
XWPFHeader headerD = policy.createHeader(policy.DEFAULT);
headerD.getParagraphs().get(0).createRun().setText("Hello Header World!");
}
FileOutputStream out = new FileOutputStream(System.currentTimeMillis()+"_test1_header.docx");
sampleDoc.write(out);
out.close();
sampleDoc.close();
}
代码示例来源:origin: stackoverflow.com
doc.close();
代码示例来源:origin: stackoverflow.com
document.close();
代码示例来源:origin: org.apache.poi/poi-examples
document.close();
} else if (contentType.equals("application/vnd.ms-powerpoint")) {
代码示例来源:origin: stackoverflow.com
docx2.close();
代码示例来源:origin: com.bstek.ureport/ureport2-core
}finally{
try{
document.close();
}catch(Exception ex){
ex.printStackTrace();
内容来源于网络,如有侵权,请联系作者删除!