• <menu id="w2i4a"></menu>
  • logo Spire.Doc系列教程

    文檔首頁(yè)>>Spire.Doc系列教程>>Spire.Doc功能演示:在Java中以編程方式將數(shù)學(xué)方程式插入Word

    Spire.Doc功能演示:在Java中以編程方式將數(shù)學(xué)方程式插入Word


    Spire.Doc for Java 是一款專業(yè)的Java Word組件,開(kāi)發(fā)人員使用它可以輕松地將Word文檔創(chuàng)建、讀取、編輯、轉(zhuǎn)換和打印等功能集成到自己的Java應(yīng)用程序中。

    本文將演示如何在Java應(yīng)用程序中使用Spire.Doc for Java到Latex Math方程和MathMLCode到Word文檔???a href="http://www.xiangyinys.com/product/4184/download" target="_blank">點(diǎn)擊此處下載最新版測(cè)試。

    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);
        }
    }

    輸出結(jié)果

    國(guó)產(chǎn)Word格式處理控件Spire.Doc功能演示:在Java中以編程方式將數(shù)學(xué)方程式插入Word


    掃碼咨詢


    添加微信 立即咨詢

    電話咨詢

    客服熱線
    023-68661681

    TOP
    三级成人熟女影院,欧美午夜成人精品视频,亚洲国产成人乱色在线观看,色中色成人论坛 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();