Class Column
Represents the page column in the Word document.
Implements
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Portable.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 = "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 = 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 = "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 = 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 |
Overrides
ReadXmlAttributes(IXDLSAttributeReader)
Reads object data from xml attributes.
Declaration
protected override void ReadXmlAttributes(IXDLSAttributeReader reader)
Parameters
Type | Name | Description |
---|---|---|
IXDLSAttributeReader | reader | The IXDLSAttributeReader object. |
Overrides
WriteXmlAttributes(IXDLSAttributeWriter)
Writes object data as xml attributes.
Declaration
protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IXDLSAttributeWriter | writer | The IXDLSAttributeWriter object. |