Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

This class is used to represent a section of the document. Many documents will only contain one section. More complex documents will divide the document into multiple sections. A section can be roughly correlated to a chapter in a book. Each section can have different formatting settings, including:

Signature
C#
C#
 public sealed class Section : Element
{signature}{signature:
}
Signature
vb.net
vb.net
Public NotInheritable Class Section
		Inherits Element
{signature}
{remarks}To create a new section, use [
Remarks

To create a new section, use Element.CreateSectionBefore

\

(

\

)

|Element.CreateSectionBefore()]. To get an existing section, use [

.

To get an existing section, use Document.Sections

|Document.Sections]. The following sample shows you how to get the add a new section to a document and how to get the first section of a document. {remarks} {example}{code:csharp|title=C#}

.

The following sample shows you how to get the add a new section to a document and how to get the first section of a document.

Example
Code Block
csharp
csharp
titleC#


          //--- Add a new section to a document
          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\sample.doc");
          Section sect = doc.CreateSectionAfter();

          //--- Get the first section of a document
          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\sample.doc");
          Section sec1 = doc.Sections[0];
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          '--- Add a new section to a document
          Dim app As New WordApplication()
          Dim doc As Document = app.Open("C:\sample.doc")
          Dim sect As Section = doc.CreateSectionAfter()

          '--- Get the first section of a document
          Dim app As New WordApplication()
          Dim doc As Document = app.Open("C:\sample.doc")
          Dim sect As Section = doc.Sections(0)
        
{code} {example} {properties} ||Name||Description|| |[BorderAlwaysInFront|Section.BorderAlwaysInFront]|{excerpt-include:Section.BorderAlwaysInFront|nopanel=true}| |[BorderAppliedTo|Section.BorderAppliedTo]|{excerpt-include:Section.BorderAppliedTo|nopanel=true}| |[BorderOffsetsFromPage|Section.BorderOffsetsFromPage]|{excerpt-include:Section.BorderOffsetsFromPage|nopanel=true}| |[BottomMargin|Section.BottomMargin]|{excerpt-include:Section.BottomMargin|nopanel=true}| |[Break|Section.Break]|{excerpt-include:Section.Break|nopanel=true}| |[FirstLineNum|Section.FirstLineNum]|{excerpt-include:Section.FirstLineNum|nopanel=true}| |[FirstPageNum|Section.FirstPageNum]|{excerpt-include:Section.FirstPageNum|nopanel=true}| |[FooterY|Section.FooterY]|{excerpt-include:Section.FooterY|nopanel=true}| |[GutterWidth|Section.GutterWidth]|{excerpt-include:Section.GutterWidth|nopanel=true}| |[HasTitlePage|Section.HasTitlePage]|{excerpt-include:Section.HasTitlePage|nopanel=true}| |[HeaderY|Section.HeaderY]|{excerpt-include:Section.HeaderY|nopanel=true}| |[LeftMargin|Section.LeftMargin]|{excerpt-include:Section.LeftMargin|nopanel=true}| |[LineNumberingType|Section.LineNumberingType]|{excerpt-include:Section.LineNumberingType|nopanel=true}| |[LineNumberX|Section.LineNumberX]|{excerpt-include:Section.LineNumberX|nopanel=true}| |[LineNumModulus|Section.LineNumModulus]|{excerpt-include:Section.LineNumModulus|nopanel=true}| |[LinesBetween|Section.LinesBetween]|{excerpt-include:Section.LinesBetween|nopanel=true}| |[NumColumns|Section.NumColumns]|{excerpt-include:Section.NumColumns|nopanel=true}| |[PageHeight|Section.PageHeight]|{excerpt-include:Section.PageHeight|nopanel=true}| |[PageNumberFormat|Section.PageNumberFormat]|{excerpt-include:Section.PageNumberFormat|nopanel=true}| |[PageOrientation|Section.PageOrientation]|{excerpt-include:Section.PageOrientation|nopanel=true}| |[PageSize|Section.PageSize]|{excerpt-include:Section.PageSize|nopanel=true}| |[PageWidth|Section.PageWidth]|{excerpt-include:Section.PageWidth|nopanel=true}| |[RestartPageNum|Section.RestartPageNum]|{excerpt-include:Section.RestartPageNum|nopanel=true}| |[RightMargin|Section.RightMargin]|{excerpt-include:Section.RightMargin|nopanel=true}| |[TopMargin|Section.TopMargin]|{excerpt-include:Section.TopMargin|nopanel=true}| |[Unlocked|Section.Unlocked]|{excerpt-include:Section.Unlocked|nopanel=true}| {methods} ||Name||Description|| |[GetBorder(Border.Location)|Section.GetBorder(Border.Location)]|{excerpt-include:
Properties

Name

Description

BorderAlwaysInFront

Excerpt Include
Section.BorderAlwaysInFront
Section.BorderAlwaysInFront
nopaneltrue

BorderAppliedTo

Excerpt Include
Section.BorderAppliedTo
Section.BorderAppliedTo
nopaneltrue

BorderOffsetsFromPage

Excerpt Include
Section.BorderOffsetsFromPage
Section.BorderOffsetsFromPage
nopaneltrue

BottomMargin

Excerpt Include
Section.BottomMargin
Section.BottomMargin
nopaneltrue

Break

Excerpt Include
Section.Break
Section.Break
nopaneltrue

FirstLineNum

Excerpt Include
Section.FirstLineNum
Section.FirstLineNum
nopaneltrue

FirstPageNum

Excerpt Include
Section.FirstPageNum
Section.FirstPageNum
nopaneltrue

FooterY

Excerpt Include
Section.FooterY
Section.FooterY
nopaneltrue

GutterWidth

Excerpt Include
Section.GutterWidth
Section.GutterWidth
nopaneltrue

HasTitlePage

Excerpt Include
Section.HasTitlePage
Section.HasTitlePage
nopaneltrue

HeaderY

Excerpt Include
Section.HeaderY
Section.HeaderY
nopaneltrue

LeftMargin

Excerpt Include
Section.LeftMargin
Section.LeftMargin
nopaneltrue

LineNumberingType

Excerpt Include
Section.LineNumberingType
Section.LineNumberingType
nopaneltrue

LineNumberX

Excerpt Include
Section.LineNumberX
Section.LineNumberX
nopaneltrue

LineNumModulus

Excerpt Include
Section.LineNumModulus
Section.LineNumModulus
nopaneltrue

LinesBetween

Excerpt Include
Section.LinesBetween
Section.LinesBetween
nopaneltrue

NumColumns

Excerpt Include
Section.NumColumns
Section.NumColumns
nopaneltrue

PageHeight

Excerpt Include
Section.PageHeight
Section.PageHeight
nopaneltrue

PageNumberFormat

Excerpt Include
Section.PageNumberFormat
Section.PageNumberFormat
nopaneltrue

PageOrientation

Excerpt Include
Section.PageOrientation
Section.PageOrientation
nopaneltrue

PageSize

Excerpt Include
Section.PageSize
Section.PageSize
nopaneltrue

PageWidth

Excerpt Include
Section.PageWidth
Section.PageWidth
nopaneltrue

RestartPageNum

Excerpt Include
Section.RestartPageNum
Section.RestartPageNum
nopaneltrue

RightMargin

Excerpt Include
Section.RightMargin
Section.RightMargin
nopaneltrue

TopMargin

Excerpt Include
Section.TopMargin
Section.TopMargin
nopaneltrue

Unlocked

Excerpt Include
Section.Unlocked
Section.Unlocked
nopaneltrue
Methods

Name

Description

GetBorder(Border.Location)

Excerpt Include
Section.GetBorder(Border.Location)
Section.GetBorder(Border.Location)

...

nopanel

...

...

Excerpt Include
Section.GetFooter(Section.HeaderFooterType)

...

Section.GetFooter(Section.HeaderFooterType)

...

nopanel

...

...

Excerpt Include
Section.GetHeader(Section.HeaderFooterType)

...

Section.GetHeader(Section.HeaderFooterType)

...

nopanel

...

true
Classes

Name

Description

BorderArea

Excerpt Include
Section.BorderArea
Section.BorderArea
nopaneltrue

BreakType

Excerpt Include
Section.BreakType
Section.BreakType
nopaneltrue

HeaderFooterType

Excerpt Include
Section.HeaderFooterType
Section.HeaderFooterType
nopaneltrue

LineNumbering

Excerpt Include
Section.LineNumbering
Section.LineNumbering
nopaneltrue

NumberFormat

Excerpt Include
Section.NumberFormat
Section.NumberFormat
nopaneltrue

Orientation

Excerpt Include
Section.Orientation
Section.Orientation
nopaneltrue

PagePaperSize

Excerpt Include
Section.PagePaperSize
Section.PagePaperSize
nopaneltrue