org.apache.poi.POIXMLDocument Java Examples
The following examples show how to use
org.apache.poi.POIXMLDocument.
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: WordExport.java From frpMgr with MIT License | 5 votes |
/** * 为文档设置模板 * @param templatePath 模板文件名称 */ public void setTemplate(String templatePath) { try { this.document = new XWPFDocument(POIXMLDocument.openPackage(templatePath)); bookMarks = new BookMarks(document); } catch (IOException e) { e.printStackTrace(); } }
Example #2
Source File: OfficeUtils.java From dk-fitting with Apache License 2.0 | 5 votes |
public static String Parse07(String FilePath) throws IOException, XmlException, OpenXML4JException{ String text2007=null; try{ OPCPackage opcPackage = POIXMLDocument.openPackage(FilePath); POIXMLTextExtractor extractor = new XWPFWordExtractor(opcPackage); text2007 = extractor.getText(); } catch (Exception e) { e.printStackTrace(); } return text2007; }
Example #3
Source File: ExcelUtils.java From onetwo with Apache License 2.0 | 5 votes |
public static OPCPackage readPackage(String path){ try { OPCPackage pack = POIXMLDocument.openPackage(path); return pack; } catch (IOException e) { throw new RuntimeException("read word file["+path+"] error:"+e.getMessage()); } }
Example #4
Source File: ExcelUtils.java From CloverETL-Engine with GNU Lesser General Public License v2.1 | 5 votes |
public static ExcelType getStreamType(InputStream is) throws IOException { if (!(is.markSupported() || is instanceof PushbackInputStream)) { throw new IOException("Stream cannot be reset to initial position"); } if (POIFSFileSystem.hasPOIFSHeader(is)) { return ExcelType.XLS; } else if (POIXMLDocument.hasOOXMLHeader(is)) { return ExcelType.XLSX; } else { return ExcelType.INVALID; } }