This article describes how to insert footnote in Word using C#. It has details to set the IDE, a list of instructions, and a sample code demonstrating how to add a footnote in Word using C#. You may add multiple footnotes using this code and customize the footnote object by using the EndnoteOptions object.
Steps to Add Footnote in Word using C#
- Set the IDE to use Aspose.Words for .NET to insert footnotes
- Load the license to avoid a watermark in the output file
- Load the input Word document into the Document class object
- Create a DocumentBuilder object by passing the uploaded Word file
- Use the builder to write new text in the loaded Word file
- Call the InsertFootnote method by passing the footnote type and text
- Access the EndnoteOptions property from the document object and set the desired properties
- Save the loaded Word file with a new footnote with text
These steps summarize the process of how to create footnote in Word using C#. Load the source Word file, link it with the DocumentBuilder object, write some text in the Word file, and insert a footnote with type using the builder object. Use the EndnoteOptions to set the parameters of the footnotes of the document and save the updated document with footnotes.
Code to Insert a Footnote in Word using C#
This code has demonstrated how to put footnotes in Word using C#. You may set the number style (e.g., Arabic, Roman, Letters, etc.) and position, such as the end of the section or the document. An option is also available to search for a word in an existing document and add an endnote to it if required.
This tutorial has taught us the process of adding footnotes. To edit macros in a Word document, refer to the article on Edit macro in Word using C#.