Column Class
Represents the page column in the Word document.
Inheritance
System.Object
Syncfusion.DocIO.DLS.XML.XDLSSerializableBase
Column
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Base.dll
Syntax
public class Column : FormatBase, IXDLSSerializable
Examples
The following code example demonstrates how to display contents in multiple columns.
private void Button1_Click(System.Object sender, System.EventArgs e)
{
//Create a new Word document
WordDocument document = new WordDocument();
//Add the section into Word document
WSection section = document.AddSection() as WSection;
//Add the column into the section
Column column1 = new Column(document);
column1.Width = 150;
column1.Space = 20;
section.Columns.Add(column1);
//Add the column into the section
Column column2 = new Column(document);
column2.Width = 150;
column2.Space = 20;
section.Columns.Add(column2);
//Add the column into the section
Column column3 = new Column(document);
column3.Width = 150;
column3.Space = 20;
section.Columns.Add(column3);
//Add a paragraph to created section
IWParagraph paragraph = section.AddParagraph();
//Add a paragraph to created section
paragraph = section.AddParagraph();
string paraText = "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is in Bothell, Washington with 290 employees, several regional sales teams are located throughout their market base.";
//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 = section.AddParagraph();
//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 = section.AddParagraph();
//Append the text to the created paragraph
paragraph.AppendText(paraText);
//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)
'Create a new Word document
Dim document As New WordDocument()
'Add the section into Word document
Dim section As WSection = TryCast(document.AddSection(), WSection)
'Add the column into the section
Dim column1 As New Column(document)
column1.Width = 150
column1.Space = 20
section.Columns.Add(column1)
'Add the column into the section
Dim column2 As New Column(document)
column2.Width = 150
column2.Space = 20
section.Columns.Add(column2)
'Add the column into the section
Dim column3 As New Column(document)
column3.Width = 150
column3.Space = 20
section.Columns.Add(column3)
'Add a paragraph to created section
Dim paragraph As IWParagraph = section.AddParagraph()
'Add a paragraph to created section
paragraph = section.AddParagraph()
Dim paraText As String = "Adventure Works Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company. The company manufactures and sells metal and composite bicycles to North American, European and Asian commercial markets. While its base operation is in Bothell, Washington with 290 employees, several regional sales teams are located throughout their market base."
'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 = section.AddParagraph()
'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 = section.AddParagraph()
'Append the text to the created paragraph
paragraph.AppendText(paraText)
'Save and close the Word document instance
document.Save("Sample.docx", FormatType.Docx)
document.Close()
End Sub
Constructors
Column(IWordDocument)
Initialize a new instance of the Column class.
Declaration
public Column(IWordDocument doc)
Parameters
| Type | Name | Description |
|---|---|---|
| IWordDocument | doc | The WordDocument object. |
Properties
Space
Gets or sets spacing between current and next column measured in points.
Declaration
public float Space { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single | The float that represents the space between the columns. |
Width
Gets or sets column width measured in points.
Declaration
public float Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single | The float that represents the width of the column. |
Methods
GetDefValue(Int32)
Gets the default values for the key.
Declaration
protected override object GetDefValue(int key)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | key |
Returns
| Type |
|---|
| System.Object |