国产Word格式处理控件Spire.Doc功能演示:在Java中以编程方式将数学方程式插入Word

import com.spire.doc.*;import com.spire.doc.documents.*;import com.spire.doc.fields.omath.*;public class wordEquation {    public static void main(String[] args){        //Create a new instance of Word and add a section        Document doc = new Document();        Section section = doc.addSection();        //Add a paragraph        Paragraph paragraph = section.addParagraph();        //Add Latex Math code        OfficeMath officeMath = new OfficeMath(doc);        paragraph.getItems().add(officeMath);        officeMath.fromLatexMathCode("x^{2}+\sqrt{{x^{2}+1}}+1");        //Add another paragraph        Paragraph paragraph2 = section.addParagraph();        //Add MathMLCode        OfficeMath officeMath2 = new OfficeMath(doc);        paragraph2.getItems().add(officeMath2);        officeMath2.fromMathMLCode("x2+x2+1+1");        //Save the document to file        String result = "output/addMathEquation.docx";        doc.saveToFile(result, FileFormat.Docx_2013);    }}

输出结果

国产Word格式处理控件Spire.Doc功能演示:在Java中以编程方式将数学方程式插入Word



Spire.Doc for Java更新至v4.5.1,该版本支持验证文档的保护密码,增强了Word到PDF/HTML/SVG的转换功能,同时还修复了加载和合并文档等时出现的问题。具体细节如下:

新功能:

Document document = new Document(); document.loadFromFile(input); boolean checkResult = document.checkProtectionPassWord(password);
  • 支持添加数字签名
  • String input="input.docx"; Document doc = new Document(); doc.loadFromFile(input); String result = "AddDigitalSignature.docx"; doc.saveToFile(result, FileFormat.Docx, "gary.pfx", "e-iceblue");

    整合所有格式API处理套包Spire.office for Java正在 火热销售中!联系客服立马1分钟了解全部咨询!

    标签:

    声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

    上一篇 2021年4月15日
    下一篇 2021年4月15日

    相关推荐

    发表回复

    登录后才能评论