【问题标题】:Converting formula/equation in docx to html using docx4j使用 docx4j 将 docx 中的公式/方程式转换为 html
【发布时间】:2012-06-23 23:15:41
【问题描述】:

我正在尝试将包含方程式的 docx 转换为 Android。我遇到了很棒的 docx4j 并测试了以下示例(HtmlExporterNonXSTL): https://github.com/plutext/docx4j/blob/android/src/main/java/org/docx4j/convert/out/html/HtmlExporterNonXSLT.java

但是我注意到它不能很好地处理方程式 - 如果某些符号或数字具有某些幂和/或索引,它们的位置总是在中间,例如 k_{n+1}^2 (latex format)

显示为:

kn+12 (with 'n+12' having correct smaller font but they are both vertically aligned)

有没有办法调整 CSS 来处理幂和索引? (完整的公式转换会更好,但我想这并不容易)。我是 docx4j 的新手,但看起来有点像 handlePPr()

方法将需要在HtmlExporterNonXSLT 示例中进行修改。在我深入研究之前,我想问是否有可能完成它(任何方式来获得运行的偏移属性?

【问题讨论】:

    标签: html docx equation docx4j


    【解决方案1】:

    披露:我是 docx4j 项目负责人

    欢迎您修改 HtmlExporterNonXSLT 以修复您的特定示例,但正如您所说,完整的公式转换会更好。

    这里是关于该主题的三个先前帖子的链接(最新的优先):

    【讨论】:

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