0

次のコードを使用してドキュメントをhtmlに変換しています

private static final String docName = "This is a test page.docx";
private static final String outputlFolderPath = "C://";
String htmlNamePath = "docHtml1.html";
String zipName="_tmp.zip";
static File docFile = new File(outputlFolderPath+docName);
File zipFile = new File(zipName);

public void ConvertWordToHtml() {
    try {
        InputStream doc = new FileInputStream(new File(outputlFolderPath+docName));
        System.out.println("InputStream"+doc);
        XWPFDocument document = new XWPFDocument(doc);
        XHTMLOptions options = XHTMLOptions.create(); //.URIResolver(new FileURIResolver(new File("word/media")));;
        String root = "target";
        File imageFolder = new File( root + "/images/" + doc );
        options.setExtractor( new FileImageExtractor( imageFolder ) );
        options.URIResolver( new FileURIResolver( imageFolder ) );
        OutputStream out = new FileOutputStream(new File(htmlPath()));
        XHTMLConverter.getInstance().convert(document, out, options);
    } catch (Exception ex) {

    }
}

public static void main(String[] args) throws IOException, ParserConfigurationException, Exception {
    Convertion cwoWord=new Convertion();
    cwoWord.ConvertWordToHtml();    

}


public String htmlPath(){
    return outputlFolderPath+htmlNamePath;
}

public String zipPath(){
    // d:/_tmp.zip
    return outputlFolderPath+zipName;
}

上記のコードは、doc を html にうまく変換しています。円のようなグラフィック (スクリーンショットに表示) を含む doc ファイルを変換しようとすると問題が発生します。この場合、グラフィックは html ファイルに表示されません。

ここに画像の説明を入力

グラフィックを doc から html ファイルに変換した後も維持する方法を教えてください。前もって感謝します

4

1 に答える 1