Wordで記事を執筆する時、ある文章の内容について、補足説明する必要があるなら、脚注機能を使うことがあります。例えば、
こういうふうに使いますね。レポートや論文でたくさん使っている機能だから、皆さんもう慣れていらっしゃるでしょう?今回はWordで脚注と文末脚注を挿入する方法を紹介します。
閑話休題、本題に入りましょう!
下準備
1.E-iceblueの公式サイトからFree Spire.Doc for .NET無料版をダウンロードしてください。
2.Visual Studioを起動して新規プロジェクトを作成してから、インストールされたファイルにあった相応しいDoc.dllを参照に追加してください。
(Net 4.0を例としたら、デフォルトパスは“Bin→NET4.0→Spire.Doc.dll”というようです。)
元のファイル
サンプルコード
usingSpire.Doc;usingSpire.Doc.Documents;usingSystem;namespaceInsertMath;classProgram{staticvoidMain(string[]args){//ドキュメントを作成します。Documentdoc=newDocument();//sectionを追加します。Sectionsection=doc.AddSection();//sectionに段落を追加します。Paragraphparagraph=section.AddParagraph();//初めの段落にLatex数式コードを追加します。OfficeMathofficeMath=newOfficeMath(doc);paragraph.Items.Add(officeMath);officeMath.FromLatexMathCode("x^{2}+\\sqrt{x^{2}+1}=2");//次の段落にLatex数式コードを追加します。Paragraphparagraph2=section.AddParagraph();OfficeMathofficeMath1=newOfficeMath(doc);paragraph2.Items.Add(officeMath1);officeMath1.FromLatexMathCode("\\forall x \\in X, \\quad \\exists y \\leq \\epsilon");//三つ目の段落に記号を追加します。Paragraphparagraph3=section.AddParagraph();OfficeMathofficeMath2=newOfficeMath(doc);paragraph3.Items.Add(officeMath2);officeMath2.FromLatexMathCode(" \\alpha,\\beta, \\gamma, \\Gamma, \\pi, \\Pi, \\phi, \\varphi, \\mu, \\Phi");//保存します。doc.SaveToFile("Equation.docx",FileFormat.Docx);System.Diagnostics.Process.Start("Equation.docx");}}}
できました!