Ejemplo n.º 1
0
        public void FootnoteOptions()
        {
            //ExStart
            //ExFor:PageSetup.EndnoteOptions
            //ExFor:PageSetup.FootnoteOptions
            //ExSummary:Shows how to configure options affecting footnotes/endnotes in a section.
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.Write("Hello world!");
            builder.InsertFootnote(FootnoteType.Footnote, "Footnote reference text.");

            // Configure all footnotes in the first section to restart the numbering from 1
            // at each new page and display themselves directly beneath the text on every page.
            FootnoteOptions footnoteOptions = doc.Sections[0].PageSetup.FootnoteOptions;

            footnoteOptions.Position    = FootnotePosition.BeneathText;
            footnoteOptions.RestartRule = FootnoteNumberingRule.RestartPage;
            footnoteOptions.StartNumber = 1;

            builder.Write(" Hello again.");
            builder.InsertFootnote(FootnoteType.Footnote, "Endnote reference text.");

            // Configure all endnotes in the first section to maintain a continuous count throughout the section,
            // starting from 1. Also, set them all to appear collected at the end of the document.
            EndnoteOptions endnoteOptions = doc.Sections[0].PageSetup.EndnoteOptions;

            endnoteOptions.Position    = EndnotePosition.EndOfDocument;
            endnoteOptions.RestartRule = FootnoteNumberingRule.Continuous;
            endnoteOptions.StartNumber = 1;

            doc.Save(ArtifactsDir + "PageSetup.FootnoteOptions.docx");
            //ExEnd

            doc             = new Document(ArtifactsDir + "PageSetup.FootnoteOptions.docx");
            footnoteOptions = doc.FirstSection.PageSetup.FootnoteOptions;

            Assert.AreEqual(FootnotePosition.BeneathText, footnoteOptions.Position);
            Assert.AreEqual(FootnoteNumberingRule.RestartPage, footnoteOptions.RestartRule);
            Assert.AreEqual(1, footnoteOptions.StartNumber);

            endnoteOptions = doc.FirstSection.PageSetup.EndnoteOptions;

            Assert.AreEqual(EndnotePosition.EndOfDocument, endnoteOptions.Position);
            Assert.AreEqual(FootnoteNumberingRule.Continuous, endnoteOptions.RestartRule);
            Assert.AreEqual(1, endnoteOptions.StartNumber);
        }
Ejemplo n.º 2
0
        public void FootnoteOptions()
        {
            //ExStart
            //ExFor:PageSetup.EndnoteOptions
            //ExFor:PageSetup.FootnoteOptions
            //ExSummary:Shows how to set options for footnotes and endnotes in current section.
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Insert text and a reference for it in the form of a footnote
            builder.Write("Hello world!.");
            builder.InsertFootnote(FootnoteType.Footnote, "Footnote reference text.");

            // Set options for footnote position and numbering
            FootnoteOptions footnoteOptions = doc.Sections[0].PageSetup.FootnoteOptions;

            footnoteOptions.Position    = FootnotePosition.BeneathText;
            footnoteOptions.RestartRule = FootnoteNumberingRule.RestartPage;
            footnoteOptions.StartNumber = 1;

            // Endnotes also have a similar options object
            builder.Write(" Hello again.");
            builder.InsertFootnote(FootnoteType.Footnote, "Endnote reference text.");

            EndnoteOptions endnoteOptions = doc.Sections[0].PageSetup.EndnoteOptions;

            endnoteOptions.Position    = EndnotePosition.EndOfDocument;
            endnoteOptions.RestartRule = FootnoteNumberingRule.Continuous;
            endnoteOptions.StartNumber = 1;

            doc.Save(ArtifactsDir + "PageSetup.FootnoteOptions.docx");
            //ExEnd

            doc             = new Document(ArtifactsDir + "PageSetup.FootnoteOptions.docx");
            footnoteOptions = doc.FirstSection.PageSetup.FootnoteOptions;

            Assert.AreEqual(FootnotePosition.BeneathText, footnoteOptions.Position);
            Assert.AreEqual(FootnoteNumberingRule.RestartPage, footnoteOptions.RestartRule);
            Assert.AreEqual(1, footnoteOptions.StartNumber);

            endnoteOptions = doc.FirstSection.PageSetup.EndnoteOptions;

            Assert.AreEqual(EndnotePosition.EndOfDocument, endnoteOptions.Position);
            Assert.AreEqual(FootnoteNumberingRule.Continuous, endnoteOptions.RestartRule);
            Assert.AreEqual(1, endnoteOptions.StartNumber);
        }
Ejemplo n.º 3
0
 public ABIW_FootNotes(Footnotes footnotes)
 {
     this.footnotes       = footnotes;
     this.rangeParent     = footnotes.Parent;
     this.footnoteOptions = rangeParent.FootnoteOptions;
 }