GemBox.Document
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    Section Class

    Namespace:
    GemBox.Document
    Assembly:
    GemBox.Document.dll

    Represents a group of Paragraphs and other Block derived elements that have a specific set of properties used to define the pages on which the text will appear, as well as other section-level properties.

    • C#
    • VB.NET
    public sealed class Section : Element, IContentElement
    Public NotInheritable Class Section
        Inherits Element
        Implements IContentElement
    Inheritance:
    System.Object
    Element
    Section
    Implements
    IContentElement
    Remarks

    Section elements are contained directly under the root element - DocumentModel and can be accessed with Sections property.

    Except holding the main document content, through Blocks property, Section can also contain HeaderFooters, that are repeated on a header or a footer of a pages showing the Section's content.

    Page setup properties, like page layout and printing options, can be customized with a PageSetup property.

    Constructors

    Section(DocumentModel)

    Initializes a new instance of the Section class.

    • C#
    • VB.NET
    public Section(DocumentModel document)
    Public Sub New(document As DocumentModel)
    Parameters
    document
    DocumentModel

    The owner document.

    Section(DocumentModel, Block[])

    Initializes a new instance of the Section class.

    • C#
    • VB.NET
    public Section(DocumentModel document, params Block[] items)
    Public Sub New(document As DocumentModel, ParamArray items As Block())
    Parameters
    document
    DocumentModel

    The owner document.

    items
    Block[]

    The section items.

    Section(DocumentModel, IEnumerable<Block>)

    Initializes a new instance of the Section class.

    • C#
    • VB.NET
    public Section(DocumentModel document, IEnumerable<Block> items)
    Public Sub New(document As DocumentModel, items As IEnumerable(Of Block))
    Parameters
    document
    DocumentModel

    The owner document.

    items
    System.Collections.Generic.IEnumerable<Block>

    The section items.

    Properties

    Blocks

    Gets the Section's blocks.

    • C#
    • VB.NET
    public BlockCollection Blocks { get; }
    Public ReadOnly Property Blocks As BlockCollection
    Property Value
    BlockCollection

    The Section's blocks.

    Remarks

    Supports all Block derived elements: Paragraph, Table and TableOfEntries.

    ElementType

    Gets the ElementType of this Element instance.

    • C#
    • VB.NET
    public override ElementType ElementType { get; }
    Public Overrides ReadOnly Property ElementType As ElementType
    Property Value
    ElementType

    The ElementType of this Element instance.

    Overrides
    Element.ElementType

    EndnoteSettings

    Gets the endnote settings.

    • C#
    • VB.NET
    public NoteSettings EndnoteSettings { get; }
    Public ReadOnly Property EndnoteSettings As NoteSettings
    Property Value
    NoteSettings

    The endnote settings.

    Remarks

    Note can be configured using NoteSettings on a document level (Footnote and Endnote) or on a section level (FootnoteSettings and EndnoteSettings. Document level settings are cloned when new Section is added to the DocumentModel.

    PDF format has the following limitations:

    • Footnotes are always rendered on the same page as their references.
    • Footnotes that don't fit on a single page are clipped.
    • Note numbering setting RestartEachPage is not supported.

    HTML and TXT formats have the following limitations:

    • All footnotes and then endnotes are exported at the end of the document.
    • Note numbering setting RestartEachPage is not supported.

    FootnoteSettings

    Gets the footnote settings.

    • C#
    • VB.NET
    public NoteSettings FootnoteSettings { get; }
    Public ReadOnly Property FootnoteSettings As NoteSettings
    Property Value
    NoteSettings

    The footnote settings.

    Remarks

    Note can be configured using NoteSettings on a document level (Footnote and Endnote) or on a section level (FootnoteSettings and EndnoteSettings. Document level settings are cloned when new Section is added to the DocumentModel.

    PDF format has the following limitations:

    • Footnotes are always rendered on the same page as their references.
    • Footnotes that don't fit on a single page are clipped.
    • Note numbering setting RestartEachPage is not supported.

    HTML and TXT formats have the following limitations:

    • All footnotes and then endnotes are exported at the end of the document.
    • Note numbering setting RestartEachPage is not supported.

    HeadersFooters

    Gets the Section's headers / footers.

    • C#
    • VB.NET
    public HeaderFooterCollection HeadersFooters { get; }
    Public ReadOnly Property HeadersFooters As HeaderFooterCollection
    Property Value
    HeaderFooterCollection

    The Section's headers / footers.

    Remarks

    Since HeaderFooter class is sealed, only supported element in this collection is HeaderFooter.

    HeaderFooterCollection cannot contain multiple HeaderFooter elements with equal HeaderFooterType.

    Following rules apply for HeaderFooterType headers / footers contained in a collection:

    • HeaderDefault / FooterDefault - header / footer will be applied to every page in a section.
    • HeaderEven / FooterEven - header / footer will be applied to only even pages in a section. Overrides HeaderDefault / FooterDefault on even pages, if also contained in a collection.
    • HeaderFirst / FooterFirst - header / footer will be applied to only first page in a section. Overrides both HeaderDefault / FooterDefault and HeaderEven / FooterEven on first page, if also contained in a collection.
    See Also
    HeaderFooter

    PageSetup

    Gets or sets the page setup.

    • C#
    • VB.NET
    public PageSetup PageSetup { get; set; }
    Public Property PageSetup As PageSetup
    Property Value
    PageSetup

    The page setup.

    Parent

    Gets the parent DocumentModel of this Section instance.

    • C#
    • VB.NET
    public DocumentModel Parent { get; }
    Public ReadOnly Property Parent As DocumentModel
    Property Value
    DocumentModel

    The parent DocumentModel of this Section instance.

    ParentCollection

    Gets the SectionCollection that contains this Section instance.

    • C#
    • VB.NET
    public SectionCollection ParentCollection { get; }
    Public ReadOnly Property ParentCollection As SectionCollection
    Property Value
    SectionCollection

    The SectionCollection that contains this Section instance.

    ProtectedForForms

    When true, the Section will be protected when the document is protected for forms.

    • C#
    • VB.NET
    public bool ProtectedForForms { get; set; }
    Public Property ProtectedForForms As Boolean
    Property Value
    System.Boolean

    true if the Section will be protected when the document is protected for forms; otherwise, false.

    Remarks

    When a section is protected for forms, you can select and modify text only in form fields.

    SectionPropertiesRevision

    Gets or sets the revision information for the section properties.

    • C#
    • VB.NET
    public SectionPropertiesRevision SectionPropertiesRevision { get; set; }
    Public Property SectionPropertiesRevision As SectionPropertiesRevision
    Property Value
    SectionPropertiesRevision

    The revision information for the section properties.

    Methods

    Clone(Boolean)

    Clones this Section instance.

    • C#
    • VB.NET
    public Section Clone(bool cloneDescendants)
    Public Function Clone(cloneDescendants As Boolean) As Section
    Parameters
    cloneDescendants
    System.Boolean

    If set to true clone all descendants recursively; otherwise clone only current Section.

    Returns
    Section

    Cloned Section.

    Remarks

    Document content element instance can exist only in a one place in the document.

    If you want to insert document content element into some other part of the same document, then clone the element and insert its clone.

    If you want to insert document content element into another document, then you should first import it into another document with Import<T>(T, Boolean, Boolean) method and then insert the imported element.

    For more information, see cloning example.

    Inherited Properties

    Content

    Gets the content of the current Element.

    (Inherited from Element)

    Document

    Gets the owner document.

    (Inherited from Element)

    Inherited Methods

    GetChildElements(System.Boolean)

    Gets the child elements.

    (Inherited from Element)

    GetChildElements(System.Boolean, ElementType[])

    Gets the child elements filtered by ElementType.

    (Inherited from Element)

    GetParentElements()

    Gets the parent elements.

    (Inherited from Element)

    GetParentElements(ElementType[])

    Gets the parent elements.

    (Inherited from Element)

    Implements

    IContentElement
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.