[]
Represents a section element in a body content.
public class Section : IBrowsable<Section>
Gets the collection of the children of this content object.
public IEnumerable<ContentObject> Children { get; }
Gets the DocumentBase that contains this content object.
public DocumentBase Document { get; }
Gets the Marker representing the end of this content object in the parent body.
public Marker End { get; }
Gets the collection of footers for this section.
public HeaderFooterCollection Footers { get; }
Gets the section unique identifier.
public string Guid { get; }
Gets the collection of headers for this section.
public HeaderFooterCollection Headers { get; }
Gets the next section.
public Section Next { get; }
Gets the PageSetup object associated with this section.
public PageSetup PageSetup { get; }
Gets the parent Body of this content object.
public Body ParentBody { get; }
Gets the previous section.
public Section Previous { get; }
Gets or sets a value indicating whether this section is protected for forms.
When a section is protected for forms, users can select and modify text only in form fields in Microsoft Word.
public bool ProtectedForForms { get; set; }
Gets unique identifiers used to track the section editing session.
public SectionRevisionId RevisionId { get; }
Gets the Marker representing the start of this content object in the parent body.
public Marker Start { get; }
Adds a ContentControl to the end of the section.
public ContentControl AddContentControl(ContentControlType type, bool fillContent = true)
type
ContentControlTypeThe new content control type.
fillContent
boolWhether to fill the new control content with default data.
The added ContentControl.
Adds a Paragraph to the end of the section.
public Paragraph AddParagraph()
Adds a Paragraph to the end of the section.
public Paragraph AddParagraph(Style style)
style
StyleThe paragraph style.
Adds a Paragraph to the end of the section.
public Paragraph AddParagraph(string text, Style style)
Adds a Paragraph to the end of the section.
public Paragraph AddParagraph(string text)
text
stringThe text of the added Paragraph
Adds a Table to the end of the section.
public Table AddTable()
Adds a Table to the end of the section.
public Table AddTable(Style style)
style
StyleThe table style.
Adds a Table to the end of the section.
public Table AddTable(int columns, int rows, Style style)
columns
intThe number of columns in the new table.
rows
intThe number of rows in the new table.
style
StyleThe table style.
Adds a Table to the end of the section.
public Table AddTable(int columns, int rows)
columns
intThe number of columns in the new table.
rows
intThe number of rows in the new table.
Adds a Table to the end of the section.
public Table AddTable(string[][] texts, Style style)
texts
string[][]A two dimensional array of texts to put in the cells. The first dimension determines the number of rows, the second the number of cells.
style
StyleThe table style.
Adds a Table to the end of the section.
public Table AddTable(string[][] texts)
texts
string[][]A two dimensional array of texts to put in the cells. The first dimension determines the number of rows, the second the number of cells.
Checks whether a ContentObject of the specified type can be added to the current section.
public bool CanAdd(Type contentObjectType, out Exception ex)
contentObjectType
System.TypeThe content object type to add.
ex
System.ExceptionOUT: the exception that would be thrown if a content object of the specified type was added.
true if a content object of the specified type can be added, false otherwise.
Checks whether a ContentObject of the specified type can be added to the current section.
public bool CanAdd(Type contentObjectType)
contentObjectType
System.TypeThe type of the content object to add.
true if a content object of the specified type can be added, false otherwise.
Checks whether a ContentControl of the specified type can be added to the current section.
public bool CanAddContentControl(ContentControlType type, out Exception ex)
type
ContentControlTypeThe type of the content control to add.
ex
System.ExceptionOUT: the exception that would be thrown if a content control of the specified type was added.
true if a content control of the specified type can be added, false otherwise.
Checks whether a ContentControl of the specified type can be added to the current section.
public bool CanAddContentControl(ContentControlType type)
type
ContentControlTypeThe type of the content control to add.
true if a content control of the specified type can be added, false otherwise.
Deletes the section from the parent Body.
public void Delete()
Gets the collection of this section's children of a specified type.
public IReadOnlyList<T> GetChildren<T>() where T : ContentObject
A readonly list of this object's children with the specified type.
T
The requested type of child objects.
Creates and returns a Range associated with this content object.
public Range GetRange()
Merges this section with the next one.
public Section MergeWithNext()
The merged section.
Merges this section with the previous one.
public Section MergeWithPrevious()
The merged section.
Gets string representation of the section.
public override string ToString()
String representation of the section.