Click or drag to resize

Note Class

Represents a footnote or an endnote in the document.
Inheritance Hierarchy

Namespace:  SautinSoft.Document
Assembly:  SautinSoft.Document (in SautinSoft.Document.dll) Version: 3.8.6.28 (3.8.6.28)
Syntax
public sealed class Note : Inline, IContentElement

The Note type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyBlocks
Gets the Note's blocks.
Public propertyCode exampleCharacterFormat
Gets or sets the note mark character format.
Public propertyContent
Gets the ContentRange of the current element.
(Inherited from Element.)
Public propertyCustomMark
Gets or sets the custom mark.
Public propertyDocument
Gets the owner document.
(Inherited from Element.)
Public propertyCode exampleElementType
Gets the ElementType of this element instance.
(Overrides ElementElementType.)
Public propertyNextSibling
Gets the next Element sibling.
(Inherited from Element.)
Public propertyCode exampleNoteType
Gets the note type.
Public propertyParent
Gets the parent of this element instance.
(Inherited from Element.)
Public propertyParentCollection
Gets the InlineCollection that contains this Inline instance.
(Inherited from Inline.)
Public propertyPreviuosSibling
Gets the previous Element sibling.
(Inherited from Element.)
Top
Methods
  NameDescription
Public methodCode exampleClone
Clones this element instance.
(Inherited from Inline.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodCode exampleGetChildElements(Boolean)
Gets the child elements.
(Inherited from Element.)
Public methodCode exampleGetChildElements(Boolean, ElementType)
Gets the child elements filtered by ElementType.
(Inherited from Element.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Explicit Interface Implementations
Examples
Create a document with a footnote in C#
using System;
using SautinSoft.Document;
using SautinSoft.Document.Tables;

namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
            CreateFootnoteAndEndnote();
        }
        /// <summary>
        /// Creates a document with a footnote and endnote.
        /// </summary>
        /// <remarks>
        /// Details: https://sautinsoft.com/products/document/examples/text-footnotes.php
        /// </remarks>
        static void CreateFootnoteAndEndnote()
        {
            string filePath = @"FootnoteAndEndnote.docx";

            DocumentCore dc = new DocumentCore();

            Paragraph p1 = new Paragraph(dc, new Run(dc, "Every evening the young Fisherman went out upon the sea, and " +
                "threw his nets into the water.")
            {
                CharacterFormat = new CharacterFormat()
                {
                    Size = 24,
                }
            });

            Paragraph p2 = new Paragraph(dc,
                           new Run(dc, "When the wind blew from the land he caught nothing, or but little at best," +
                           " for it was a bitter and black-winged wind, and rough waves rose up to meet it")
                           {
                               CharacterFormat = new CharacterFormat()
                               {
                                   Size = 24,
                               }
                           },
                           new Note(dc, NoteType.Endnote, "This is the endnote.")
                           {
                               CharacterFormat = new CharacterFormat()
                               {
                                   Size = 36,
                                   Superscript = true
                               }
                           },
                           new Run(dc, " . But when the wind blew to the shore, the " +
                           "fish came in from the deep, and swam into the meshes of his nets, " +
                            "and he took them to the market-place and sold them.")
                           {
                               CharacterFormat = new CharacterFormat()
                               {
                                   Size = 24
                               }
                           },
                           new Note(dc, NoteType.Endnote, "This is the endnote.")
                           {
                               CharacterFormat = new CharacterFormat()
                               {
                                   Size = 36,
                                   Superscript = true
                               }
                           });

            Paragraph p3 = new Paragraph(dc,
                new Run(dc, "Every evening he went out upon the sea, and one evening the net " +
                " was so heavy that hardly could he draw it into the boat")
                {
                    CharacterFormat = new CharacterFormat()
                    {
                        Size = 24,
                    }
                },
                new Note(dc, NoteType.Footnote, "This is the footnote.")
                {
                    CharacterFormat = new CharacterFormat()
                    {
                        Size = 36,
                        Superscript = true
                    }
                },
                new Run(dc, ". And he laughed, and said to himself, �Surely I  " +
                "have caught all the fish that swim, or snared some dull monster that will be a marvel to men, or some thing  " +
                "of horror that the great Queen will desire,� and putting forth all his strength, he tugged at the coarse ropes  " +
                "till, like lines of blue enamel round a vase of bronze, the long veins rose up on his arms.")
                {
                    CharacterFormat = new CharacterFormat()
                    {
                        Size = 24,
                    }
                },
                new Note(dc, NoteType.Endnote, "This is the endnote.")
                {
                    CharacterFormat = new CharacterFormat()
                    {
                        Size = 36,
                        Superscript = true
                    }
                },
                new Run(dc, "He tugged at the  " +
                "thin ropes, and nearer and nearer came the circle of flat corks, and the net rose at last to the top of the water.")
                {
                    CharacterFormat = new CharacterFormat()
                    {
                        Size = 24,
                    }
                });

            Note footnote = new Note(dc, NoteType.Footnote, "This is the footnote.");
            footnote.CharacterFormat.Superscript = true;
            footnote.CharacterFormat.Size = 36;

            p1.Content.End.Insert(footnote.Content);
            p3.Content.End.Insert(footnote.Content);
            dc.Content.End.Insert(p1.Content);
            dc.Content.End.Insert(p2.Content);
            dc.Content.End.Insert(p3.Content);

            dc.Save(filePath);

            // Show the result.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true });
        }
    }
}
Create a document with a footnote in VB.Net
Imports System
Imports SautinSoft.Document
Imports SautinSoft.Document.Tables

Namespace Example
    Friend Class Program
        Shared Sub Main(ByVal args() As String)
            CreateFootnoteAndEndnote()
        End Sub
        ''' <summary>
        ''' Creates a document with a footnote and endnote.
        ''' </summary>
        ''' <remarks>
        ''' Details: https://sautinsoft.com/products/document/examples/text-footnotes.php
        ''' </remarks>
        Private Shared Sub CreateFootnoteAndEndnote()
            Dim filePath As String = "FootnoteAndEndnote.docx"

            Dim dc As New DocumentCore()

            Dim p1 As Paragraph = New Paragraph(dc, New Run(dc, "Every evening the young Fisherman went out upon the sea, and " & "threw his nets into the water.") With {
                .CharacterFormat = New CharacterFormat() With {.Size = 24}
            })

            Dim p2 As Paragraph = New Paragraph(dc, New Run(dc, "When the wind blew from the land he caught nothing, or but little at best," & " for it was a bitter and black-winged wind, and rough waves rose up to meet it") With {
                .CharacterFormat = New CharacterFormat() With {.Size = 24}
            },
            New Note(dc, NoteType.Endnote, "This is the endnote.") With {
                .CharacterFormat = New CharacterFormat() With {
                    .Size = 36,
                    .Superscript = True
                }
            },
            New Run(dc, " . But when the wind blew to the shore, the " & "fish came in from the deep, and swam into the meshes of his nets, " & "and he took them to the market-place and sold them.") With {
                .CharacterFormat = New CharacterFormat() With {.Size = 24}
            },
            New Note(dc, NoteType.Endnote, "This is the endnote.") With {
                .CharacterFormat = New CharacterFormat() With {
                    .Size = 36,
                    .Superscript = True
                }
            })

            Dim p3 As Paragraph = New Paragraph(dc, New Run(dc, "Every evening he went out upon the sea, and one evening the net " & " was so heavy that hardly could he draw it into the boat") With {
                .CharacterFormat = New CharacterFormat() With {.Size = 24}
            },
            New Note(dc, NoteType.Footnote, "This is the footnote.") With {
                .CharacterFormat = New CharacterFormat() With {
                    .Size = 36,
                    .Superscript = True
                }
            },
            New Run(dc, ". And he laughed, and said to himself, ‘Surely I  " & "have caught all the fish that swim, or snared some dull monster that will be a marvel to men, or some thing  " & "of horror that the great Queen will desire,’ and putting forth all his strength, he tugged at the coarse ropes  " & "till, like lines of blue enamel round a vase of bronze, the long veins rose up on his arms.") With {
                .CharacterFormat = New CharacterFormat() With {.Size = 24}
            },
            New Note(dc, NoteType.Endnote, "This is the endnote.") With {
                .CharacterFormat = New CharacterFormat() With {
                    .Size = 36,
                    .Superscript = True
                }
            },
            New Run(dc, "He tugged at the  " & "thin ropes, and nearer and nearer came the circle of flat corks, and the net rose at last to the top of the water.") With {
                .CharacterFormat = New CharacterFormat() With {.Size = 24}
            })

            Dim footnote As New Note(dc, NoteType.Footnote, "This is the footnote.")
            footnote.CharacterFormat.Superscript = True
            footnote.CharacterFormat.Size = 36

            p1.Content.End.Insert(footnote.Content)
            p3.Content.End.Insert(footnote.Content)
            dc.Content.End.Insert(p1.Content)
            dc.Content.End.Insert(p2.Content)
            dc.Content.End.Insert(p3.Content)

            dc.Save(filePath)

            ' Show the result.
            System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(filePath) With {.UseShellExecute = True})
        End Sub
    End Class
End Namespace
See Also