Footnotes.cs
//
// This code is part of Document Solutions for Word demos.
// Copyright (c) MESCIUS inc. All rights reserved.
//
using System;
using System.IO;
using System.Drawing;
using GrapeCity.Documents.Word;

namespace DsWordWeb.Demos
{
    // Shows how to add and format footnotes.
    public class Footnotes
    {
        public GcWordDocument CreateDocx()
        {
            GcWordDocument doc = new GcWordDocument();
            // First section:
            var sec1 = doc.Body.Sections.First;
            // Section paragraphs:
            var pars1 = sec1.GetRange().Paragraphs;
            // Add a new paragraph:
            var p1 = pars1.Add("Section 1, Paragraph 1. " + Util.LoremIpsumPar());
            // Add two footnotes to the paragraph:
            p1.GetRange().Footnotes.Add("This is footnote 1 for Section 1, Paragraph 1.");
            p1.GetRange().Footnotes.Add("This is footnote 2 for Section 1, Paragraph 1.");
            // Add another paragraph, and a footnote to it:
            var p2 = pars1.Add("Section 1, Paragraph 2. ");
            p2.GetRange().Runs.Add(Util.LoremIpsumPar()).GetRange().Footnotes.Add(
                "This is a footnote for the last run in Section 1, Paragraph 2.");
            // Add 3rd paragraph:
            pars1.Add("Section 1, Paragraph 3. " + Util.LoremIpsumPar());

            // Done:
            return doc;
        }
    }
}