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:vb.net} Public NotInheritable Class Section Inherits Element {signature} {remarks}To create a new section, use [Element.CreateSectionBefore\(\)|Element.CreateSectionBefore()]. 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#} //--- 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) {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: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=true}| {classes} ||Name||Description|| |[BorderArea|Section.BorderArea]|{excerpt-include:Section.BorderArea|nopanel=true}| |[BreakType|Section.BreakType]|{excerpt-include:Section.BreakType|nopanel=true}| |[HeaderFooterType|Section.HeaderFooterType]|{excerpt-include:Section.HeaderFooterType|nopanel=true}| |[LineNumbering|Section.LineNumbering]|{excerpt-include:Section.LineNumbering|nopanel=true}| |[NumberFormat|Section.NumberFormat]|{excerpt-include:Section.NumberFormat|nopanel=true}| |[Orientation|Section.Orientation]|{excerpt-include:Section.Orientation|nopanel=true}| |[PagePaperSize|Section.PagePaperSize]|{excerpt-include:Section.PagePaperSize|nopanel=true}| |
Page History
Overview
Content Tools