# Footnote and Endnote

In DsWord, use footnotes and endnotes to explain the additional information in a Word document. Learn how to add, delete, and modify them in DsWord docs.

## Content

The purpose of using footnotes and endnotes in a document is to explain or provide additional information in a document like a reference or credits to something or someone mentioned in a document. The difference between footnotes and endnotes is that a footnote is displayed at the bottom of each page of a document and endnote appears at the end of a section or a document.
DsWord allows you to add a footnote and endnote using [Add](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.FootnoteCollection.Add.html) method of the [FootnoteCollection](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.FootnoteCollection.html) class and [EndnoteCollection](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.EndnoteCollection.html) class respectively. It lets you set the footnote and endnote position, numbering rule and number style for a document or a section using the [FootnoteOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.FootnoteOptions.html) and [EndnoteOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.EndnoteOptions.html) class respectively. These classes can be accessed using [FootnoteOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Settings.FootnoteOptions.html) and [EndnoteOptions](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Settings.EndnoteOptions.html) properties of the [Settings](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Settings.html) class respectively.
![Word document with a footnote and an endnote](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/images/footnoteendnote.gif)

## Add Footnote and Endnote

To add a footnote and endnote:

1. Set the footnote and endnote options using the **FootnoteOptions** property and the **EndnoteOptions** property respectively.
2. Access a content object to which a footnote and endnote needs to be added. For example, access a section of the document.
3. Add a footnote using **Add** method of the **FootnoteCollection** class.
4. Add an endnote using **Add** method of the **EndnoteCollection** class.

    ```csharp
    doc.Load("HeaderFooter.docx");
    
    //Set footnote options
    doc.Settings.FootnoteOptions.Location = FootnoteLocation.BottomOfPage;
    doc.Settings.FootnoteOptions.NumberingRule = FootnoteNumberingRule.Continuous;
    
    //Add footnote in first section
    var section = doc.Body.Sections.First;                      
    section.GetRange().Paragraphs.First.GetRange().Footnotes.Add("This is a test footnote.");
    
    //Add footnote in second section
    var section2 = doc.Body.Sections[1];
    var secondRun = section2.GetRange().Paragraphs.First.GetRange().Runs.Insert(InsertLocation.End);
    secondRun.GetRange().Texts.Add("This is a reference text for a footnote.");
    secondRun.GetRange().Footnotes.Add("Footnote for second section");
    
    //Set endnote options
    doc.Settings.EndnoteOptions.Location = EndnoteLocation.EndOfDocument;
    doc.Settings.EndnoteOptions.NumberingRule = EndnoteNumberingRule.Continuous;
    
    //Add endnote at the end of the document
    section.GetRange().Paragraphs[1].GetRange().Endnotes.Add("This is a test endnote.");
    
    //Save the document
    doc.Save("AddNotes.docx");
    ```

## Modify Footnote and Endnote

To modify a footnote and endnote:

1. Modify the footnote and endnote option using the **FootnoteOptions** property and the **EndnoteOptions** property respectively. For example, modify the location.
2. Access the footnote and endnote which needs to be modified. For example, access the first footnote and endnote added to the document.
3. Modify text of the footnote and endnote added to the document using [Value](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Text.Value.html) property of the [Text](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Text.html) class.

    ```csharp
    doc.Load("AddNotes.docx");
    
    //Modify footnote options
    doc.Settings.FootnoteOptions.Location = FootnoteLocation.EndOfSection;            
    
    //Modify the footnote in first section
    var section = doc.Body.Sections.First;
    section.GetRange().Paragraphs.First.GetRange().Footnotes.First.Body.Texts.First.Value = "This" +
        " is a modified test footnote.";
    
    //Modify endnote  
    doc.Settings.EndnoteOptions.Location = EndnoteLocation.EndOfSection;
    
    //Modify the endnote in first section
    section.GetRange().Paragraphs[1].GetRange().Endnotes.First.Body.Texts.First.Value = "This" +
        " is a modified test endnote.";
    
    //Save the document
    doc.Save("ModifyNotes.docx");
    ```

## Delete Footnote and Endnote

To delete a footnote and endnote, access the footnote and endnote and delete them using [Delete](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ContentObject.Delete.html) method of the [ContentObject](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ContentObject.html) class.

```csharp
doc.Load("AddNotes.docx");

//Add footnote in first section.
var section2 = doc.Body.Sections[1];
section2.GetRange().Paragraphs.First.GetRange().Footnotes.First.Delete();

//Delete EndNote
var section = doc.Body.Sections.First;
section.GetRange().Paragraphs[1].GetRange().Endnotes.First.Delete();

//Save the document
doc.Save("DeleteNotes.docx");
```

## Set Numbering Style

To set numbering style of footnotes and endnotes:

1. Access the footnote and endnote options using the **FootnoteOptions** and **EndnoteOptions** property respectively.
2. Set the numbering style for the footnotes and endnotes using **NumberStyle** property of the FootnoteOptions and EndnoteOptions class respectively, which takes value from the [NumberStyle](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.NumberStyle.html) enumeration.

    ```csharp
    doc.Load("AddNotes.docx");
    
    //Set footnote numbering style
    doc.Settings.FootnoteOptions.NumberStyle = NumberStyle.DecimalEnclosedCircle;
    
    //Set endnote numbering style            
    doc.Settings.EndnoteOptions.NumberStyle = NumberStyle.NumberInDash;
    
    //Save the document
    doc.Save("SetNumbering.docx");
    ```

For more information on how to implement footnotes and endnotes in a Word document using DsWord, see [DsWord sample browser](https://developer.mescius.com/documents-api-word/demos/basics/content/footnotes/code-cs).