Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
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:

|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#}

          //--- 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:vb.net
|title=vb.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)
        
Signature
C#C#
Wiki Markup
{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:{excerpt}
{signature:C#}
 public sealed class Section : Element
Signature
{signature}{signature:vb.net
vb.net
}
Public NotInheritable Class Section
		Inherits Element
Remarks
To create a new section, use
{signature}
{remarks}To create a new section, use [Element.CreateSectionBefore\(\)
.To get an existing section, use
|Element.CreateSectionBefore()].

To get an existing section, use [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.

Example
Code Block
csharpcsharp
titleC#
Code Block
vb.nettitle
Properties

...

Name

...

Description

...

BorderAlwaysInFront

...

{code}

{example}
{properties}
||Name||Description||
|[BorderAlwaysInFront|Section.BorderAlwaysInFront]|{excerpt-include:Section.BorderAlwaysInFront

...

BorderAppliedTo

|nopanel=true}|
|[BorderAppliedTo|Section.BorderAppliedTo]|{excerpt-include

...

:Section.BorderAppliedTo

...

BorderOffsetsFromPage

|nopanel=true}|
|[BorderOffsetsFromPage|Section.BorderOffsetsFromPage]|{excerpt-include

...

:Section.BorderOffsetsFromPage

...

BottomMargin

|nopanel=true}|
|[BottomMargin|Section.BottomMargin]|{excerpt-include

...

:Section.BottomMargin

...

Break

|nopanel=true}|
|[Break|Section.Break]|{excerpt-include

...

:Section.Break

...

FirstLineNum

|nopanel=true}|
|[FirstLineNum|Section.FirstLineNum]|{excerpt-include

...

:Section.FirstLineNum

...

FirstPageNum

|nopanel=true}|
|[FirstPageNum|Section.FirstPageNum]|{excerpt-include

...

:Section.FirstPageNum

...

FooterY

|nopanel=true}|
|[FooterY|Section.FooterY]|{excerpt-include

...

:Section.FooterY

...

GutterWidth

|nopanel=true}|
|[GutterWidth|Section.GutterWidth]|{excerpt-include

...

:Section.GutterWidth

...

HasTitlePage

|nopanel=true}|
|[HasTitlePage|Section.HasTitlePage]|{excerpt-include

...

:Section.HasTitlePage

...

HeaderY

|nopanel=true}|
|[HeaderY|Section.HeaderY]|{excerpt-include

...

:Section.HeaderY

...

LeftMargin

|nopanel=true}|
|[LeftMargin|Section.LeftMargin]|{excerpt-include

...

:Section.LeftMargin

...

LineNumberingType

|nopanel=true}|
|[LineNumberingType|Section.LineNumberingType]|{excerpt-include

...

:Section.LineNumberingType

...

LineNumberX

|nopanel=true}|
|[LineNumberX|Section.LineNumberX]|{excerpt-include

...

:Section.LineNumberX

...

LineNumModulus

|nopanel=true}|
|[LineNumModulus|Section.LineNumModulus]|{excerpt-include

...

:Section.LineNumModulus

...

LinesBetween

|nopanel=true}|
|[LinesBetween|Section.LinesBetween]|{excerpt-include

...

:Section.LinesBetween

...

NumColumns

|nopanel=true}|
|[NumColumns|Section.NumColumns]|{excerpt-include

...

:Section.NumColumns

...

PageHeight

|nopanel=true}|
|[PageHeight|Section.PageHeight]|{excerpt-include

...

:Section.PageHeight

...

PageNumberFormat

|nopanel=true}|
|[PageNumberFormat|Section.PageNumberFormat]|{excerpt-include

...

:Section.PageNumberFormat

...

PageOrientation

|nopanel=true}|
|[PageOrientation|Section.PageOrientation]|{excerpt-include

...

:Section.PageOrientation

...

PageSize

|nopanel=true}|
|[PageSize|Section.PageSize]|{excerpt-include

...

:Section.PageSize

...

PageWidth

|nopanel=true}|
|[PageWidth|Section.PageWidth]|{excerpt-include

...

:Section.PageWidth

...

RestartPageNum

|nopanel=true}|
|[RestartPageNum|Section.RestartPageNum]|{excerpt-include

...

:Section.RestartPageNum

...

RightMargin

|nopanel=true}|
|[RightMargin|Section.RightMargin]|{excerpt-include

...

:Section.RightMargin

...

TopMargin

|nopanel=true}|
|[TopMargin|Section.TopMargin]|{excerpt-include

...

:Section.TopMargin

...

Unlocked

|nopanel=true}|
|[Unlocked|Section.Unlocked]|{excerpt-include

...

:Section.Unlocked

...

Methods

...

Name

...

Description

|nopanel=true}|
{methods}
||Name||Description||
|[GetBorder(Border.Location)

...

|Section.GetBorder(Border.Location)

...

]|{excerpt-include:Section.GetBorder(Border.Location)

...

|nopanel

...

=true}|
|[GetFooter(Section.HeaderFooterType)

...

|Section.GetFooter(Section.HeaderFooterType)

...

]|{excerpt-include:Section.GetFooter(Section.HeaderFooterType)

...

|nopanel

...

=true}|
|[GetHeader(Section.HeaderFooterType)

...

|Section.GetHeader(Section.HeaderFooterType)

...

]|{excerpt-include:Section.GetHeader(Section.HeaderFooterType)

...

|nopanel

...

Classes

...

Name

...

Description

...

BorderArea

...

=true}|
{classes}
||Name||Description||
|[BorderArea|Section.BorderArea]|{excerpt-include:Section.BorderArea

...

BreakType

|nopanel=true}|
|[BreakType|Section.BreakType]|{excerpt-include

...

:Section.BreakType

...

HeaderFooterType

|nopanel=true}|
|[HeaderFooterType|Section.HeaderFooterType]|{excerpt-include

...

:Section.HeaderFooterType

...

LineNumbering

|nopanel=true}|
|[LineNumbering|Section.LineNumbering]|{excerpt-include

...

:Section.LineNumbering

...

NumberFormat

|nopanel=true}|
|[NumberFormat|Section.NumberFormat]|{excerpt-include

...

:Section.NumberFormat

...

Orientation

|nopanel=true}|
|[Orientation|Section.Orientation]|{excerpt-include

...

:Section.Orientation

...

PagePaperSize

|nopanel=true}|
|[PagePaperSize|Section.PagePaperSize]|{excerpt-include

...

:Section.PagePaperSize

...

|nopanel=true}|