Class ColumnCollection
Represents the collection of Column in the section of a Word document.
Implements
System.Collections.IEnumerable
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Portable.dll
Syntax
public class ColumnCollection : CollectionImpl, IEnumerable
Examples
The following code example demonstrates how to
private void Button1_Click(System.Object sender, System.EventArgs e)
{
//Load an existing Word document into DocIO instance
WordDocument document = new WordDocument("Template.docx");
foreach (WSection section in document.Sections)
{
//Populates the specified number of columns with specified spacing.
if (section.Columns.Count > 0)
section.Columns.Populate(2, 10);
}
//Add the section into Word document
IWSection newSection = document.AddSection();
//Add the column into the section
newSection.AddColumn(150, 20);
//Add the column into the section
newSection.AddColumn(150, 20);
//Add a paragraph to created section
IWParagraph paragraph = newSection.AddParagraph();
//Add a paragraph to created section
paragraph = newSection.AddParagraph();
string paraText = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum Turpis facilisis vitae consequat, cum a a,turpis dui consequat massa in dolor per, felis non amet.Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula";
//Append the text to the created paragraph
paragraph.AppendText(paraText);
//Add the column breaks
paragraph.AppendBreak(BreakType.ColumnBreak);
//Add a paragraph to created section
paragraph = newSection.AddParagraph();
//Append the text to the created paragraph
paragraph.AppendText(paraText);
//Add the column breaks
paragraph.AppendBreak(BreakType.ColumnBreak);
//Save and close the Word document instance
document.Save("Sample.docx", FormatType.Docx);
document.Close();
}
Private Sub button_Click(sender As Object, e As EventArgs)
'Load an existing Word document into DocIO instance
Dim document As New WordDocument("Template.docx")
For Each section As WSection In document.Sections
'Populates the specified number of columns with specified spacing.
If section.Columns.Count > 0 Then
section.Columns.Populate(2, 10)
End If
Next
'Add the section into Word document
Dim newSection As IWSection = document.AddSection()
'Add the column into the section
newSection.AddColumn(150, 20)
'Add the column into the section
newSection.AddColumn(150, 20)
'Add a paragraph to created section
Dim paragraph As IWParagraph = newSection.AddParagraph()
'Add a paragraph to created section
paragraph = newSection.AddParagraph()
Dim paraText As String = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum Turpis facilisis vitae consequat, cum a a,turpis dui consequat massa in dolor per, felis non amet.Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula"
'Append the text to the created paragraph
paragraph.AppendText(paraText)
'Add the column breaks
paragraph.AppendBreak(BreakType.ColumnBreak)
'Add a paragraph to created section
paragraph = newSection.AddParagraph()
'Append the text to the created paragraph
paragraph.AppendText(paraText)
'Add the column breaks
paragraph.AppendBreak(BreakType.ColumnBreak)
'Save and close the Word document instance
document.Save("Sample.docx", FormatType.Docx)
document.Close()
End Sub
Properties
Item[Int32]
Gets the Column at the specified index.
Declaration
public Column this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the column in the collection. |
Property Value
Type | Description |
---|---|
Column | The Column at the specified index. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
Methods
Add(Column)
Adds Column object to the collection.
Declaration
public int Add(Column column)
Parameters
Type | Name | Description |
---|---|---|
Column | column | The Column to be added. |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based index of the column. |
Populate(Int32, Single)
Populates the specified number of columns with specified spacing.
Declaration
public void Populate(int count, float spacing)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | count | The integer specifying the columns count. |
System.Single | spacing | The float that specifies the spacing between columns. |
Implements
System.Collections.IEnumerable