本篇內(nèi)容介紹了“C#在Word中添加Latex數(shù)學(xué)公式和符號(hào)的方法”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

注意:需要使用7.6.5版本及以上的Spire.Doc for .NET,本文中下載使用的是hotfix 8.4.2版本
dll添加引用效果,如下圖:

using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields.OMath;
namespace Create
{
class Program
{
static void Main(string[] args)
{
//新建word實(shí)例
Document doc = new Document();
//添加一個(gè)section
Section section = doc.AddSection();
//添加一個(gè)段落
Paragraph paragraph = section.AddParagraph();
//在第一段添加公式
OfficeMath officeMath = new OfficeMath(doc);
paragraph.Items.Add(officeMath);
officeMath.FromLatexMathCode("x^{2}+\\sqrt{x^{2}+1}=2");
//添加第二個(gè)公式到第二段
Paragraph paragraph3 = section.AddParagraph();
OfficeMath officeMath2 = new OfficeMath(doc);
paragraph3.Items.Add(officeMath2);
officeMath2.FromLatexMathCode("\\forall x \\in X, \\quad \\exists y \\leq \\epsilon");
//添加符號(hào)到第三段
Paragraph paragraph4 = section.AddParagraph();
OfficeMath officeMath3 = new OfficeMath(doc);
paragraph4.Items.Add(officeMath3);
officeMath3.FromLatexMathCode(" \\alpha,\\beta, \\gamma, \\Gamma, \\pi, \\Pi, \\phi, \\varphi, \\mu, \\Phi");
//保存文檔
doc.SaveToFile("result.docx", FileFormat.Docx);
System.Diagnostics.Process.Start("result.docx");
}
}
}公式/符號(hào)添加效果:

“C#在Word中添加Latex數(shù)學(xué)公式和符號(hào)的方法”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!
分享標(biāo)題:C#在Word中添加Latex數(shù)學(xué)公式和符號(hào)的方法-創(chuàng)新互聯(lián)
網(wǎng)頁地址:http://www.chinadenli.net/article14/dgscde.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、App設(shè)計(jì)、云服務(wù)器、移動(dòng)網(wǎng)站建設(shè)、App開發(fā)、網(wǎng)頁設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容