【问题标题】:Docx4j - horizontal line missing while converting xhtml to docx using doc4jDocx4j - 使用 doc4j 将 xhtml 转换为 docx 时缺少水平线
【发布时间】:2015-01-09 00:01:15
【问题描述】:

我正在使用 doc4j 将 xhtml 转换为 docx。 但是 xhtml 中存在的水平线没有被添加到 docx 中。以下是我正在使用的 sn-p。谁能帮我解决这个问题?

String stringFromFile = FileUtils.readFileToString(new File(dest

                + "/" + xhtmlFile), "UTF-8");
        WordprocessingMLPackage docxOut = WordprocessingMLPackage
                .createPackage();

        NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
        docxOut.getMainDocumentPart().addTargetPart(ndp);
        ndp.unmarshalDefaultNumbering();
        XHTMLImporterImpl XHTMLImporter = new XHTMLImporterImpl(docxOut);
        XHTMLImporter.setHyperlinkStyle("Hyperlink");
        docxOut.getMainDocumentPart().getContent()
                .addAll(XHTMLImporter.convert(stringFromFile, null));

【问题讨论】:

  • 水平线是
    元素还是别的什么?
  • 嗨,杰森,是的,它的

标签: java xhtml docx docx4j


【解决方案1】:

This commit 添加了对 hr 的支持,使用与 Word 2010 相同的 Open XML。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-21
    • 1970-01-01
    • 2013-12-26
    • 1970-01-01
    • 2013-11-08
    • 1970-01-01
    • 2021-06-15
    • 1970-01-01
    相关资源
    最近更新 更多