The method of adding Latex Mathematical Formula and symbols in Word by C #
This article introduces the relevant knowledge of "the method of adding Latex mathematical formulas and symbols by C# in Word". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Note: Spire.Doc for .NET version 7.6.5 or above is required. Hotfix 8.4.2 is used for download in this article.
Dll adds a reference effect, as shown below:
Using Spire.Doc;using Spire.Doc.Documents;using Spire.Doc.Fields.OMath; namespace Create {class Program {static void Main (string [] args) {/ / New word instance Document doc = new Document (); / / add a section Section section = doc.AddSection () / / add a paragraph Paragraph paragraph = section.AddParagraph (); / / add the formula OfficeMath officeMath = new OfficeMath (doc); paragraph.Items.Add (officeMath) in the first paragraph; officeMath.FromLatexMathCode ("x ^ {2} +\\ sqrt {x ^ {2} + 1} = 2") / / add the second formula to the second paragraph Paragraph paragraph3 = section.AddParagraph (); OfficeMath officeMath2 = new OfficeMath (doc); paragraph3.Items.Add (officeMath2); officeMath2.FromLatexMathCode ("\\ forall x\\ in X,\\ quad\\ exists y\\ leq\\ epsilon") / / add symbols to the third paragraph 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") / / Save document doc.SaveToFile ("result.docx", FileFormat.Docx); System.Diagnostics.Process.Start ("result.docx");}
Formula / symbol addition effect:
This is the end of the introduction of "the method of adding Latex mathematical formulas and symbols to Word by C#". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!