翻譯|使用教程|編輯:胡濤|2022-04-19 13:46:05.367|閱讀 247 次
概述:本文將向您展示如何將 Latex 數學符號和方程式添加到 Word 文檔中,歡迎查閱!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
從 7.6.5 版本開始,Spire.Doc 支持將 Latex 數學代碼添加到 C# 中的 Word 文檔中。本文將向您展示如何將 Latex 數學符號和方程式添加到 Word 文檔中。
展示代碼:
using Spire.Doc; using Spire.Doc.Documents; using System; namespace InsertMath; class Program { static void Main(string[] args) { //create a word document Document doc = new Document(); //add a section Section section = doc.AddSection(); //add a paragraph to the section Paragraph paragraph = section.AddParagraph(); //add a LatexMathcode to the first paragraph OfficeMath officeMath = new OfficeMath(doc); paragraph.Items.Add(officeMath); officeMath.FromLatexMathCode("x^{2}+\\sqrt{x^{2}+1}=2"); //add equation to the second paragraph Paragraph paragraph2 = section.AddParagraph(); OfficeMath officeMath1 = new OfficeMath(doc); paragraph2.Items.Add(officeMath1); officeMath1.FromLatexMathCode("\\forall x \\in X, \\quad \\exists y \\leq \\epsilon"); //add symbols to the third paragraph Paragraph paragraph3 = section.AddParagraph(); OfficeMath officeMath2 = new OfficeMath(doc); paragraph3.Items.Add(officeMath2); officeMath2.FromLatexMathCode(" \\alpha,\\beta, \\gamma, \\Gamma, \\pi, \\Pi, \\phi, \\varphi, \\mu, \\Phi"); //save the document to file doc.SaveToFile("Equation.docx", FileFormat.Docx); System.Diagnostics.Process.Start("Equation.docx"); } } }
將latex數學代碼和符號添加到word文檔后的有效截圖:
歡迎下載|體驗更多E-iceblue產品
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn