Interface IColumns
Represents a collection of IColumn objects in a table.
Inherited Members
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Base.dll
Syntax
public interface IColumns : IEnumerable<IColumn>, IEnumerable
Properties
Count
Gets the number of elements in the column collection. Read-only.
Declaration
int Count { get; }
Property Value
Type |
---|
System.Int32 |
Examples
//Create instance of PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add table to the slide
ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200);
//Get the column collection from table
IColumns columns = table.Columns;
//Retrieve a single column from the column collection, read only
IColumn column = columns[0];
//Add a specific column to the collection
columns.Add(column);
//Get the count of column collection, read only
int count = columns.Count;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create instance of PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add table to the slide
Dim table As ITable = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200)
'Get the column collection from table
Dim columns As IColumns = table.Columns
'Retrieve a single column from the column collection, read only
Dim column As IColumn = columns(0)
'Add a specific column to the collection
columns.Add(column)
'Get the count of column collection, read only
Dim count As Integer = columns.Count
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Item[Int32]
Gets a IColumn instance at the specified index from the column collection. Read-only.
Declaration
IColumn this[int columnIndex] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | columnIndex | Specifies the index of the column to locate. |
Property Value
Type | Description |
---|---|
IColumn | Returns an IColumn instance. |
Examples
//Create instance of PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add table to the slide
ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200);
//Get the column from column collection
IColumn column = table.Columns[0];
//Set the width of the column
column.Width = 240;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create instance of PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add table to the slide
Dim table As ITable = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200)
'Get the column from column collection
Dim column As IColumn = table.Columns(0)
'Set the width of the column
column.Width = 300
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Methods
Add()
Adds a new column at the end of the column collection.
Declaration
IColumn Add()
Returns
Type | Description |
---|---|
IColumn | Returns the newly added IColumn instance. |
Examples
//Create instance of PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add table to the slide
ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200);
//Get the column collection from table
IColumns columns = table.Columns;
//Add column to the collection
columns.Add();
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create instance of PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add table to the slide
Dim table As ITable = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200)
'Get the column collection from table
Dim columns As IColumns = table.Columns
'Add column to the collection
columns.Add()
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Add(IColumn)
Adds the specified column at the end of the column collection.
Declaration
int Add(IColumn column)
Parameters
Type | Name | Description |
---|---|---|
IColumn | column | Represents an IColumn instance to be added. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the zero-based index of the newly added column object in the column collection. |
Examples
//Create instance of PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add table to the slide
ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200);
//Get the column collection from table
IColumns columns = table.Columns;
//Retrieve a single column from the column collection, read only
IColumn column = columns[0];
//Add a specific column to the collection
columns.Add(column);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create instance of PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add table to the slide
Dim table As ITable = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200)
'Get the column collection from table
Dim columns As IColumns = table.Columns
'Retrieve a single column from the column collection, read only
Dim column As IColumn = columns(0)
'Add a specific column to the collection
columns.Add(column)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Clear()
Removes all the elements from column collection.
Declaration
void Clear()
Examples
//Create instance of PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add table to the slide
ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200);
//Get the column collection from table
IColumns columns = table.Columns;
//Retrieve a single column from the column collection, read only
IColumn column = columns[0];
//Add a specific column to the collection
columns.Add(column);
//Clear the column collection
columns.Clear();
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create instance of PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add table to the slide
Dim table As ITable = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200)
'Get the column collection from table
Dim columns As IColumns = table.Columns
'Retrieve a single column from the column collection, read only
Dim column As IColumn = columns(0)
'Add a specific column to the collection
columns.Add(column)
'Clear the column collection
columns.Clear()
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
IndexOf(IColumn)
Returns the zero-based index of the first occurrence of the IColumn instance within the collection.
Declaration
int IndexOf(IColumn value)
Parameters
Type | Name | Description |
---|---|---|
IColumn | value | The IColumn instance to locate in the collection. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the zero-based index of the first occurrence of column instance within the collection, if found; otherwise, –1. |
Examples
//Create instance of PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add table to the slide
ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200);
//Get the column collection from table
IColumns columns = table.Columns;
//Retrieve a single column from the column collection, read only
IColumn column = table.Columns[0];
//Add a specific column to the collection
columns.Add(column);
//Get the index of a specific column from the collection
int index = columns.IndexOf(column);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create instance of PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add table to the slide
Dim table As ITable = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200)
'Get the column collection from table
Dim columns As IColumns = table.Columns
'Retrieve a single column from the column collection, read only
Dim column As IColumn = columns(0)
'Add a specific column to the collection
columns.Add(column)
'Get the index of a specific column from the collection
Dim index As Integer = columns.IndexOf(column)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Insert(Int32, IColumn)
Inserts the specified column at specified index in the table.
Declaration
void Insert(int index, IColumn item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which the column should be inserted. |
IColumn | item |
Examples
//Create instance of PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add table to the slide
ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200);
//Retrieve a single column from the column collection, read only
IColumn column = table.Columns[0];
//Set fill type for the cell in a column
column.Cells[0].Fill.FillType = FillType.Solid;
//Set color of the solid fill
column.Cells[0].Fill.SolidFill.Color = ColorObject.SaddleBrown;
//Get the column collection from table
IColumns columns = table.Columns;
//Insert column at index 2
columns.Insert(2, column);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create instance of PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add table to the slide
Dim table As ITable = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200)
'Get the column collection from table
Dim columns As IColumns = table.Columns
'Retrieve a single column from the column collection, read only
Dim column As IColumn = columns(0)
'Set fill type for the cell in a column
column.Cells(0).Fill.FillType = FillType.Solid
'Set color of the solid fill
column.Cells(0).Fill.SolidFill.Color = ColorObject.SaddleBrown
'Insert column at index 2
columns.Insert(2, column)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Remove(IColumn)
Removes the first occurrence of a specified column from the column collection.
Declaration
void Remove(IColumn value)
Parameters
Type | Name | Description |
---|---|---|
IColumn | value | The column object to be removed from the collection. |
Examples
//Create instance of PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add table to the slide
ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200);
//Retrieve a single column from the column collection, read only
IColumn column = table.Columns[0];
//Get the column collection from table
IColumns columns = table.Columns;
//Remove a specific column instance
columns.Remove(column);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create instance of PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add table to the slide
Dim table As ITable = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200)
'Get the column collection from table
Dim columns As IColumns = table.Columns
'Retrieve a single column from the column collection, read only
Dim column As IColumn = table.Columns(0)
'Remove a specific column instance
columns.Remove(column)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
RemoveAt(Int32)
Removes the column at the specified index of the column collection.
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the column to remove. |
Examples
//Create instance of PowerPoint presentation
IPresentation presentation = Presentation.Create();
//Add slide to the presentation
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add table to the slide
ITable table = slide.Shapes.AddTable(4, 2, 100, 120, 300, 200);
//Get the column collection from table
IColumns columns = table.Columns;
//Remove a specific column instance
columns.RemoveAt(0);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create instance of PowerPoint presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add slide to the presentation
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add table to the slide
Dim table As ITable = slide.Shapes.AddTable(4, 2, 100, 120, 300, 200)
'Get the column collection from table
Dim columns As IColumns = table.Columns
'Remove a specific column instance
columns.RemoveAt(0)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()