How to set the position and number format for word footnote in C#

We have already demonstrated how to insert footnote to the word document with the help of Spire.Doc. This article we will show you how to set the position and number format for the footnote. The footnote position can be at the bottom of each page or below text. The default number format for the footnote is “1, 2, 3”. The following example shows how to set the position, number format, and the restart rule of footnote by calling the property of Section.FootnoteOptions.

Firstly, view the Footnote options under Microsoft Word and the original sample document file:

How to set the position and number format for word footnote in C#

How to set the position and number format for word footnote in C#

How to set the position and number format for word footnote in C#

Step 1: Create a new instance of Document and load the document from file.

Document doc = new Document();
doc.LoadFromFile("Sample.docx",FileFormat.Docx2013);

Step 2: Get the first section from the document.

Section sec = doc.Sections[0];

Step 3: Set the number format, restart rule and position for the footnote.

sec.FootnoteOptions.NumberFormat = FootnoteNumberFormat.UpperCaseLetter;
sec.FootnoteOptions.RestartRule = FootnoteRestartRule.RestartPage;
sec.FootnoteOptions.Position = FootnotePosition.PrintAtBottomOfPage;

Step 4: Save the document to file.

doc.SaveToFile("Footnoteoptions.docx", FileFormat.Docx2013);

Effective screenshot after setting the formatting for the footnote.

How to set the position and number format for word footnote in C#

How to set the position and number format for word footnote in C#

Full codes of how to set the footnote options:

Document doc = new Document();
doc.LoadFromFile("Sample.docx", FileFormat.Docx2013);

Section sec = doc.Sections[0];

sec.FootnoteOptions.NumberFormat = FootnoteNumberFormat.UpperCaseLetter;
sec.FootnoteOptions.RestartRule = FootnoteRestartRule.RestartPage;
sec.FootnoteOptions.Position = FootnotePosition.PrintAtBottomOfPage;

////Clear all the formatting for the footnote and back to the default opitions
//sec.FootnoteOptions.ClearFormatting();

doc.SaveToFile("Footnoteoptions.docx", FileFormat.Docx2013);