Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PageNumbers

    Show / Hide Table of Contents

    Class PageNumbers

    Represents the page numbers in the Word document.

    Inheritance
    System.Object
    OwnerHolder
    XDLSSerializableBase
    FormatBase
    PageNumbers
    Implements
    IXDLSSerializable
    Inherited Members
    FormatBase.m_propertiesHash
    FormatBase.m_oldPropertiesHash
    FormatBase.ImportContainer(FormatBase)
    FormatBase.ImportMembers(FormatBase)
    FormatBase.HasKey(Int32)
    FormatBase.HasBoolKey(Int32)
    FormatBase.ClearFormatting()
    FormatBase.GetDefComposite(Int32)
    FormatBase.OnChange(FormatBase, Int32)
    FormatBase.EnsureComposites()
    FormatBase.EnsureComposites(Int32[])
    FormatBase.GetBaseKey(Int32)
    FormatBase.GetFullKey(Int32)
    FormatBase.GetDefComposite(Int32, FormatBase)
    FormatBase.Item[Int32]
    XDLSSerializableBase.IXDLSSerializable.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.IXDLSSerializable.RestoreReference(String, Int32)
    XDLSSerializableBase.CloneImpl()
    XDLSSerializableBase.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.InitXDLSHolder()
    XDLSSerializableBase.RestoreReference(String, Int32)
    XDLSSerializableBase.IXDLSSerializable.XDLSHolder
    XDLSSerializableBase.XDLSHolder
    OwnerHolder.m_doc
    OwnerHolder.Document
    Namespace: Syncfusion.DocIO.DLS
    Assembly: Syncfusion.DocIO.Portable.dll
    Syntax
    public class PageNumbers : FormatBase, IXDLSSerializable
    Examples

    The following code example demonstrates how to chapter numbering in the document.

    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Create a new Word document
        WordDocument document = new WordDocument();
        //Add the section into Word document
        IWSection section = document.AddSection();
        //Add the page number to document
        section.PageSetup.PageStartingNumber = 1;
        section.PageSetup.RestartPageNumbering = true;
        section.PageSetup.PageNumberStyle = PageNumberStyle.Arabic;
        //Specify the chapter number for heading 1
        section.PageSetup.PageNumbers.HeadingLevelForChapter = HeadingLevel.Heading1;
        //SPecify t he chapter number and page number separator
        section.PageSetup.PageNumbers.ChapterPageSeparator = ChapterPageSeparatorType.Colon;
        //Add a footer paragraph text to the document
        IWParagraph paragraph = section.HeadersFooters.Footer.AddParagraph();
        paragraph.ParagraphFormat.Tabs.AddTab(523f, TabJustification.Right, Syncfusion.DocIO.DLS.TabLeader.NoLeader);
        //Add text for the footer paragraph
        paragraph.AppendText("Copyright Northwind Inc. 2001 - 2015");
        //Add page number field to the document
        paragraph.AppendText("\tPage ");
        paragraph.AppendField("Page", FieldType.FieldPage);
        //Add the paragraph to the text body of the section
        paragraph = section.AddParagraph();
        paragraph.AppendText("First Title with Heading 1 Style");
        //Apply Heading 1 built-in style
        paragraph.ApplyStyle(BuiltinStyle.Heading1);
        WParagraphStyle paraStyle = document.Styles.FindByName("Heading 1") as WParagraphStyle;
        //Add the number format list for the Heading 1 style
        paraStyle.ListFormat.ApplyDefNumberedStyle();
        paraStyle.ListFormat.CurrentListLevel.PatternType = ListPatternType.UpLetter;
        //Add the paragraph
        paragraph = section.AddParagraph();
        //Append the text to the created paragraph
        paragraph.AppendText("Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum Turpis facilisis vitae consequat, cum a a,turpis dui consequat massa in dolor per, felis non amet.Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula");
        //Add the page break 
        paragraph.AppendBreak(Syncfusion.DocIO.DLS.BreakType.PageBreak);
        //Add the another paragraph to section
        paragraph = section.AddParagraph();
        paragraph.AppendText("Second Title with Heading 1 Style");
        //Apply Heading 1 built-in style
        paragraph.ApplyStyle(BuiltinStyle.Heading1);
        //Add the paragraph
        paragraph = section.AddParagraph();
        //Append the text to the created paragraph
        paragraph.AppendText("Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum Turpis facilisis vitae consequat, cum a a,turpis dui consequat massa in dolor per, felis non amet.Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula");
        //Save and close the Word document instance
        document.Save("Sample.docx", FormatType.Docx);
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        'Create a new Word document
        Dim document As New WordDocument()
        'Add the section into Word document
        Dim section As IWSection = document.AddSection()
        'Add the page number to document
        section.PageSetup.PageStartingNumber = 1
        section.PageSetup.RestartPageNumbering = True
        section.PageSetup.PageNumberStyle = PageNumberStyle.Arabic
        'Specify the chapter number for heading 1
        section.PageSetup.PageNumbers.HeadingLevelForChapter = HeadingLevel.Heading1
        'SPecify t he chapter number and page number separator
        section.PageSetup.PageNumbers.ChapterPageSeparator = ChapterPageSeparatorType.Colon
        'Add a footer paragraph text to the document
        Dim paragraph As IWParagraph = section.HeadersFooters.Footer.AddParagraph()
        paragraph.ParagraphFormat.Tabs.AddTab(523F, TabJustification.Right, Syncfusion.DocIO.DLS.TabLeader.NoLeader)
        'Add text for the footer paragraph
        paragraph.AppendText("Copyright Northwind Inc. 2001 - 2015")
        'Add page number field to the document
        paragraph.AppendText(vbTab & "Page ")
        paragraph.AppendField("Page", FieldType.FieldPage)
        'Add the paragraph to the text body of the section
        paragraph = section.AddParagraph()
        paragraph.AppendText("First Title with Heading 1 Style")
        'Apply Heading 1 built-in style
        paragraph.ApplyStyle(BuiltinStyle.Heading1)
        Dim paraStyle As WParagraphStyle = TryCast(document.Styles.FindByName("Heading 1"), WParagraphStyle)
        'Add the number format list for the Heading 1 style
        paraStyle.ListFormat.ApplyDefNumberedStyle()
        paraStyle.ListFormat.CurrentListLevel.PatternType = ListPatternType.UpLetter
        'Add the paragraph
        paragraph = section.AddParagraph()
        'Append the text to the created paragraph
        paragraph.AppendText("Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum Turpis facilisis vitae consequat, cum a a,turpis dui consequat massa in dolor per, felis non amet.Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula")
        'Add the page break 
        paragraph.AppendBreak(Syncfusion.DocIO.DLS.BreakType.PageBreak)
        'Add the another paragraph to section
        paragraph = section.AddParagraph()
        paragraph.AppendText("Second Title with Heading 1 Style")
        'Apply Heading 1 built-in style
        paragraph.ApplyStyle(BuiltinStyle.Heading1)
        'Add the paragraph
        paragraph = section.AddParagraph()
        'Append the text to the created paragraph
        paragraph.AppendText("Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum Turpis facilisis vitae consequat, cum a a,turpis dui consequat massa in dolor per, felis non amet.Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula")
        'Save and close the Word document instance
        document.Save("Sample.docx", FormatType.Docx)
        document.Close()
    End Sub

    Constructors

    PageNumbers()

    Initializes a new instance of PageNumbers class.

    Declaration
    public PageNumbers()

    Properties

    ChapterPageSeparator

    Gets or sets the separator between chapter number and page number.

    Declaration
    public ChapterPageSeparatorType ChapterPageSeparator { get; set; }
    Property Value
    Type Description
    ChapterPageSeparatorType

    The ChapterPageSeparatorType member that specifies the numbering separator.

    HeadingLevelForChapter

    Gets or sets the heading level to include chapter number along with page number.

    Declaration
    public HeadingLevel HeadingLevelForChapter { get; set; }
    Property Value
    Type Description
    HeadingLevel

    The HeadingLevel member that specifies the heading level of the chapter.

    Methods

    GetDefValue(Int32)

    Return the default values for the property.

    Declaration
    protected override object GetDefValue(int key)
    Parameters
    Type Name Description
    System.Int32 key
    Returns
    Type Description
    System.Object
    Overrides
    FormatBase.GetDefValue(Int32)

    Implements

    IXDLSSerializable
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved