jopconverter

启动oo
cd C:\Program Files\OpenOffice.org 3\program
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

最好加上 try-catch
发生 Exception 后,connection 不会自动关闭,程序会 hand 住
所以改成如下方式:
try {
            connection.connect();
            DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
            converter.convert(inputFile, outputFile);
        } catch(Exception e) {
            e.printStackTrace();
        } finally {
            try{ if(connection != null){connection.disconnect(); connection = null;}}catch(Exception e){}
        }

支持格式

From (any of) To (any of)
Text Formats
OpenDocument Text (*.odt)
OpenOffice.org 1.0 Text (*.sxw)
Rich Text Format (*.rtf)
Microsoft Word (*.doc)
WordPerfect (*.wpd)
Plain Text (*.txt)
HTML1 (*.html)
Portable Document Format (*.pdf)
OpenDocument Text (*.odt)
OpenOffice.org 1.0 Text (*.sxw)
Rich Text Format (*.rtf)
Microsoft Word (*.doc)
Plain Text (*.txt)
HTML2 (*.html)
MediaWiki wikitext (*.wiki)
Spreadsheet Formats
OpenDocument Spreadsheet (*.ods)
OpenOffice.org 1.0 Spreadsheet (*.sxc)
Microsoft Excel (*.xls)
Comma-Separated Values (*.csv)
Tab-Separated Values (*.tsv)
Portable Document Format (*.pdf)
OpenDocument Spreadsheet (*.ods)
OpenOffice.org 1.0 Spreadsheet (*.sxc)
Microsoft Excel (*.xls)
Comma-Separated Values (*.csv)
Tab-Separated Values (*.tsv)
HTML2 (*.html)
Presentation Formats
OpenDocument Presentation (*.odp)
OpenOffice.org 1.0 Presentation (*.sxi)
Microsoft PowerPoint (*.ppt)
Portable Document Format (*.pdf)
Macromedia Flash (*.swf)
OpenDocument Presentation (*.odp)
OpenOffice.org 1.0 Presentation (*.sxi)
Microsoft PowerPoint (*.ppt)
HTML2 (*.html)
Drawing Formats
OpenDocument Drawing (*.odg) Scalable Vector Graphics (*.svg)
Macromedia Flash (*.swf)

 

你可能感兴趣的:(html,Microsoft,Excel,Flash,OO)