Java Code Examples for org.artofsolving.jodconverter.document.DocumentFormat#setStoreProperties()
The following examples show how to use
org.artofsolving.jodconverter.document.DocumentFormat#setStoreProperties() .
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: OfficePDFConverter.java From sun-wordtable-read with Apache License 2.0 | 6 votes |
public static void doc2Docx(String inputFile,String outputFile) { File pdfFile = new File(outputFile); if (pdfFile.exists()) { pdfFile.delete(); } try{ long startTime = System.currentTimeMillis(); //打开服务 startService(); OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager); DocumentFormat docx = converter.getFormatRegistry().getFormatByExtension("docx"); docx.setStoreProperties(DocumentFamily.TEXT, Collections.singletonMap("FilterName", "MS Word 2007 XML")); //开始转换 converter.convert(new File(inputFile),new File(outputFile), docx); //关闭 stopService(); System.out.println("运行结束"); }catch (Exception e) { // TODO: handle exception e.printStackTrace(); } }
Example 2
Source File: Doc2DocxUtil.java From sun-wordtable-read with Apache License 2.0 | 6 votes |
public static void doc2Docx(String inputFile,String outputFile) { File pdfFile = new File(outputFile); if (pdfFile.exists()) { pdfFile.delete(); } try{ //打开服务 startService(); OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager); DocumentFormat docx = converter.getFormatRegistry().getFormatByExtension("docx"); docx.setStoreProperties(DocumentFamily.TEXT, Collections.singletonMap("FilterName", "MS Word 2007 XML")); //开始转换 converter.convert(new File(inputFile),new File(outputFile), docx); //关闭 stopService(); System.out.println("运行结束"); }catch (Exception e) { // TODO: handle exception e.printStackTrace(); } }
Example 3
Source File: Doc2DocxUtil.java From sun-wordtable-read with Apache License 2.0 | 5 votes |
private static void transformBinaryWordDocToDocX(File in, File out) { OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager); DocumentFormat docx = converter.getFormatRegistry().getFormatByExtension("docx"); docx.setStoreProperties(DocumentFamily.TEXT, Collections.singletonMap("FilterName", "MS Word 2007 XML")); converter.convert(in, out, docx); }
Example 4
Source File: Doc2DocxUtil.java From sun-wordtable-read with Apache License 2.0 | 5 votes |
private static void transformBinaryWordDocToW2003Xml(File in, File out) { OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);; DocumentFormat w2003xml = new DocumentFormat("Microsoft Word 2003 XML", "xml", "text/xml"); w2003xml.setInputFamily(DocumentFamily.TEXT); w2003xml.setStoreProperties(DocumentFamily.TEXT, Collections.singletonMap("FilterName", "MS Word 2003 XML")); converter.convert(in, out, w2003xml); }
Example 5
Source File: CommonDocumentConverter.java From sun-wordtable-read with Apache License 2.0 | 5 votes |
@Override public void convert() { OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager); System.out.println("转换前处理..."); before(); //开始转换 System.out.println("转换开始执行,["+inputFile+"]转换为["+outputFile+"]..."); if(StringUtils.isNotBlank(extraOutputFormatToNeed)) { DocumentFormat extraFormat = converter.getFormatRegistry().getFormatByExtension(extraOutputFormatToNeed); extraFormat.setStoreProperties(DocumentFamily.TEXT, Collections.singletonMap("FilterName", extraOutputFormatMap.get(extraOutputFormatToNeed))); if(needTempFile) { converter.convert(new File(tempFile),new File(outputFile), extraFormat); } else { converter.convert(new File(inputFile),new File(outputFile), extraFormat); } } else { if(needTempFile) { converter.convert(new File(tempFile),new File(outputFile)); } else { converter.convert(new File(inputFile),new File(outputFile)); } } System.out.println("转换后处理..."); after(); System.out.println("转换完成"); }