Convert DOC file to DOCX with Java

前端 未结 7 1996
天涯浪人
天涯浪人 2021-02-20 12:43

I need to use DOCX files (actually the XML contained in them) in a Java software I\'m currently developing, but some people in my company still use the DOC format.

Do yo

7条回答
  •  悲哀的现实
    2021-02-20 13:42

    To convert DOC file to HTML look at this (Convert Word doc to HTML programmatically in Java)

    Use this: http://poi.apache.org/

    Or use this :

    XWPFDocument docx = new XWPFDocument(OPCPackage.openOrCreate(new File("hello.docx")));  
    XWPFWordExtractor wx = new XWPFWordExtractor(docx);  
    String text = wx.getText();  
    System.out.println("text = "+text); 
    

提交回复
热议问题