Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9533

C# Wordで脚注と文末脚注を挿入

$
0
0

Wordで記事を執筆する時、ある文章の内容について、補足説明する必要があるなら、脚注機能を使うことがあります。例えば、

f:id:lendoris:20201111113925p:plain


こういうふうに使いますね。レポートや論文でたくさん使っている機能だから、皆さんもう慣れていらっしゃるでしょう?今回はWordで脚注と文末脚注を挿入する方法を紹介します。

閑話休題、本題に入りましょう!

下準備

1.E-iceblueの公式サイトからFree Spire.Doc for .NET無料版をダウンロードしてください。

f:id:lendoris:20201027114413p:plain



2.Visual Studioを起動して新規プロジェクトを作成してから、インストールされたファイルにあった相応しいDoc.dllを参照に追加してください。

Net 4.0を例としたら、デフォルトパスは“Bin→NET4.0→Spire.Doc.dll”というようです。)

 

f:id:lendoris:20200922164301p:plain

元のファイル

 

f:id:lendoris:20201111113930p:plain

サンプルコード

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

 できました!

 

f:id:lendoris:20201111113938p:plain

 

 


Viewing all articles
Browse latest Browse all 9533

Trending Articles