File Formats

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface ITable

    Show / Hide Table of Contents

    Interface ITable

    Represents the table in a slide.

    Inherited Members
    ISlideItem.Clone()
    ISlideItem.Description
    ISlideItem.SlideItemType
    ISlideItem.Height
    ISlideItem.Hidden
    ISlideItem.Left
    ISlideItem.LineFormat
    ISlideItem.ShapeName
    ISlideItem.Title
    ISlideItem.Top
    ISlideItem.Width
    Namespace: Syncfusion.Presentation
    Assembly: Syncfusion.Presentation.Base.dll
    Syntax
    public interface ITable : ISlideItem

    Properties

    BuiltInStyle

    Gets or sets a BuiltInTableStyle instance that represents the table style.

    Declaration
    BuiltInTableStyle BuiltInStyle { get; set; }
    Property Value
    Type Description
    BuiltInTableStyle

    The built in style.

    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 row collection from the table, it is read only
    IRows rows = table.Rows;
    //Set the text content for specific cell in a row
    rows[0].Cells[0].TextBody.AddParagraph("Row - 1, Column - 1");
    //Set the builtin style for the table
    table.BuiltInStyle = BuiltInTableStyle.MediumStyle2Accent6;
    //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 row collection from the table, it is read only
    Dim rows As IRows = table.Rows
    'Set the text content for specific cell in a row
    rows(0).Cells(0).TextBody.AddParagraph("Row - 1, Column - 1")
    'Set the builtin style for the table
    table.BuiltInStyle = BuiltInTableStyle.MediumStyle2Accent6
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Columns

    Gets an IColumns instance that represents the column collection. Read-only.

    Declaration
    IColumns Columns { get; }
    Property Value
    Type Description
    IColumns

    The columns.

    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 row collection from the table, it is read only
    IColumns columns = table.Columns;
    //Set the text content for specific cell in a column
    columns[0].Cells[0].TextBody.AddParagraph("Column - 1, Row - 1");
    //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 row collection from the table, it is read only
    Dim columns As IColumns = table.Columns
    'Set the text content for specific cell in a column
    columns(0).Cells(0).TextBody.AddParagraph("Column - 1, Row - 1")
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    ColumnsCount

    Gets the total number of columns in the table.

    Declaration
    int ColumnsCount { get; }
    Property Value
    Type Description
    System.Int32
    Examples
    //Create instance of PowerPoint presentation
    IPresentation presDoc = Presentation.Create();
    //Add slide to the presentation
    ISlide slide = presDoc.Slides.Add(SlideLayoutType.Blank);
    //Add table to the slide
    ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200);
    //Get the total number of columns in the table
    int columnsCount = table.ColumnsCount;
    //Save the presentation
    presDoc.Save("Sample.pptx");
    //Close the presentation
    presDoc.Close();

    ///

    Dim presDoc As IPresentation = Presentation.Create()
    ‘Add slide to the presentation
    Dim slide As ISlide = presDoc.Slides.Add(SlideLayoutType.Blank)
    ‘Add table to the slide
    Dim table As ITable = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200)
    ‘Get the total number of columns in the table
    Dim columnsCount As Integer = table.ColumnsCount
    ‘Save the presentation
    presDoc.Save("Sample.pptx")
    ‘Close the presentation
    presDoc.Close()
    ///

    HasBandedColumns

    Gets or sets a boolean value indicates whether to display banded columns, in which even columns are formatted differently from odd columns.

    Declaration
    bool HasBandedColumns { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if this instance has banded columns; otherwise, false.

    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 each cell and fill text content to the cell, it is read only
    ICell cell = table[0, 0];
    cell.TextBody.AddParagraph("First Row and First Column");
    cell = table[0, 1];
    cell.TextBody.AddParagraph("First Row and Second Column");
    cell = table[1, 0];
    cell.TextBody.AddParagraph("Second Row and First Column");
    cell = table[1, 1];
    cell.TextBody.AddParagraph("Second Row and Second Column");
    //Set vertical banding for the table
    table.HasBandedColumns = true;
    //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)
    'Retrieve each cell and fill text content to the cell, it is read only
    Dim cell As ICell = table(0, 0)
    cell.TextBody.AddParagraph("First Row and First Column")
    cell = table(0, 1)
    cell.TextBody.AddParagraph("First Row and Second Column")
    cell = table(1, 0)
    cell.TextBody.AddParagraph("Second Row and First Column")
    cell = table(1, 1)
    cell.TextBody.AddParagraph("Second Row and Second Column")
    'Set vertical banding for the table
    table.HasBandedColumns = True
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    HasBandedRows

    Gets or sets a boolean value indicates whether to display banded rows, in which even rows are formatted differently from odd rows.

    Declaration
    bool HasBandedRows { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if this instance has banded rows; otherwise, false.

    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 each cell and fill text content to the cell, it is read only
    ICell cell = table[0, 0];
    cell.TextBody.AddParagraph("First Row and First Column");
    cell = table[0, 1];
    cell.TextBody.AddParagraph("First Row and Second Column");
    cell = table[1, 0];
    cell.TextBody.AddParagraph("Second Row and First Column");
    cell = table[1, 1];
    cell.TextBody.AddParagraph("Second Row and Second Column");
    //Set horizontal banding for the table
    table.HasBandedRows = true;
    //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)
    'Retrieve each cell and fill text content to the cell, it is read only
    Dim cell As ICell = table(0, 0)
    cell.TextBody.AddParagraph("First Row and First Column")
    cell = table(0, 1)
    cell.TextBody.AddParagraph("First Row and Second Column")
    cell = table(1, 0)
    cell.TextBody.AddParagraph("Second Row and First Column")
    cell = table(1, 1)
    cell.TextBody.AddParagraph("Second Row and Second Column")
    'Set horizontal banding for the table
    table.HasBandedRows = True
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    HasFirstColumn

    Gets or sets a boolean value indicates whether to display special formatting for the first column.

    Declaration
    bool HasFirstColumn { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if this instance has first column; otherwise, false.

    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 each cell and fill text content to the cell, it is read only
    ICell cell = table[0, 0];
    cell.TextBody.AddParagraph("First Row and First Column");
    cell = table[0, 1];
    cell.TextBody.AddParagraph("First Row and Second Column");
    cell = table[1, 0];
    cell.TextBody.AddParagraph("Second Row and First Column");
    cell = table[1, 1];
    cell.TextBody.AddParagraph("Second Row and Second Column");
    //Set the table has first column
    table.HasFirstColumn = true;
    //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)
    'Retrieve each cell and fill text content to the cell, it is read only
    Dim cell As ICell = table(0, 0)
    cell.TextBody.AddParagraph("First Row and First Column")
    cell = table(0, 1)
    cell.TextBody.AddParagraph("First Row and Second Column")
    cell = table(1, 0)
    cell.TextBody.AddParagraph("Second Row and First Column")
    cell = table(1, 1)
    cell.TextBody.AddParagraph("Second Row and Second Column")
    'Set the table has first column
    table.HasFirstColumn = True
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    HasHeaderRow

    Gets or sets a boolean value indicates whether to display special formatting for the first row.

    Declaration
    bool HasHeaderRow { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if this instance has header row; otherwise, false.

    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 each cell and fill text content to the cell, it is read only
    ICell cell = table[0, 0];
    cell.TextBody.AddParagraph("First Row and First Column");
    cell = table[0, 1];
    cell.TextBody.AddParagraph("First Row and Second Column");
    cell = table[1, 0];
    cell.TextBody.AddParagraph("Second Row and First Column");
    cell = table[1, 1];
    cell.TextBody.AddParagraph("Second Row and Second Column");
    //Set the header row
    table.HasHeaderRow = true;
    //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)
    'Retrieve each cell and fill text content to the cell, it is read only
    Dim cell As ICell = table(0, 0)
    cell.TextBody.AddParagraph("First Row and First Column")
    cell = table(0, 1)
    cell.TextBody.AddParagraph("First Row and Second Column")
    cell = table(1, 0)
    cell.TextBody.AddParagraph("Second Row and First Column")
    cell = table(1, 1)
    cell.TextBody.AddParagraph("Second Row and Second Column")
    'Set the table has header row
    table.HasHeaderRow = True
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    HasLastColumn

    Gets or sets a boolean value indicates whether to display special formatting for the last column.

    Declaration
    bool HasLastColumn { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if this instance has last column; otherwise, false.

    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 each cell and fill text content to the cell, it is read only
    ICell cell = table[0, 0];
    cell.TextBody.AddParagraph("First Row and First Column");
    cell = table[0, 1];
    cell.TextBody.AddParagraph("First Row and Second Column");
    cell = table[1, 0];
    cell.TextBody.AddParagraph("Second Row and First Column");
    cell = table[1, 1];
    cell.TextBody.AddParagraph("Second Row and Second Column");
    //Set the last column
    table.HasLastColumn = true;
    //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)
    'Retrieve each cell and fill text content to the cell, it is read only
    Dim cell As ICell = table(0, 0)
    cell.TextBody.AddParagraph("First Row and First Column")
    cell = table(0, 1)
    cell.TextBody.AddParagraph("First Row and Second Column")
    cell = table(1, 0)
    cell.TextBody.AddParagraph("Second Row and First Column")
    cell = table(1, 1)
    cell.TextBody.AddParagraph("Second Row and Second Column")
    'Set the table has last column
    table.HasLastColumn = True
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    HasTotalRow

    Gets or sets a boolean value indicates whether to display special formatting for the last row of the specified table.

    Declaration
    bool HasTotalRow { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if this instance has total row; otherwise, false.

    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 each cell and fill text content to the cell, it is read only
    ICell cell = table[0, 0];
    cell.TextBody.AddParagraph("First Row and First Column");
    cell = table[0, 1];
    cell.TextBody.AddParagraph("First Row and Second Column");
    cell = table[1, 0];
    cell.TextBody.AddParagraph("Second Row and First Column");
    cell = table[1, 1];
    cell.TextBody.AddParagraph("Second Row and Second Column");
    //Set the total row
    table.HasTotalRow = true;
    //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)
    'Retrieve each cell and fill text content to the cell, it is read only
    Dim cell As ICell = table(0, 0)
    cell.TextBody.AddParagraph("First Row and First Column")
    cell = table(0, 1)
    cell.TextBody.AddParagraph("First Row and Second Column")
    cell = table(1, 0)
    cell.TextBody.AddParagraph("Second Row and First Column")
    cell = table(1, 1)
    cell.TextBody.AddParagraph("Second Row and Second Column")
    'Set the table has total row
    table.HasTotalRow = True
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Item[Int32, Int32]

    Gets a single ICell instance from the table. Read-only.

    Declaration
    ICell this[int rowIndex, int columnIndex] { get; }
    Parameters
    Type Name Description
    System.Int32 rowIndex

    Determines the row index.

    System.Int32 columnIndex

    Determines the column index.

    Property Value
    Type Description
    ICell

    Returns an ICell 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);
    //Retrieve each cell and fill text content to the cell, it is read only
    ICell cell = table[0, 0];
    cell.TextBody.AddParagraph("First Row and First Column");
    cell = table[0, 1];
    cell.TextBody.AddParagraph("First Row and Second Column");
    cell = table[1, 0];
    cell.TextBody.AddParagraph("Second Row and First Column");
    cell = table[1, 1];
    cell.TextBody.AddParagraph("Second Row and Second 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)
    'Retrieve each cell and fill text content to the cell, it is read only
    Dim cell As ICell = table(0, 0)
    cell.TextBody.AddParagraph("First Row and First Column")
    cell = table(0, 1)
    cell.TextBody.AddParagraph("First Row and Second Column")
    cell = table(1, 0)
    cell.TextBody.AddParagraph("Second Row and First Column")
    cell = table(1, 1)
    cell.TextBody.AddParagraph("Second Row and Second Column")
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Rows

    Gets an IRows instance that represents the row collection. Read-only.

    Declaration
    IRows Rows { get; }
    Property Value
    Type Description
    IRows

    The rows.

    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 row collection from the table, it is read only
    IRows rows = table.Rows;
    //Set the text content for specific cell in a row
    rows[0].Cells[0].TextBody.AddParagraph("Row - 1, Column - 1");
    //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 row collection from the table, it is read only
    Dim rows As IRows = table.Rows
    'Set the text content for specific cell in a row
    rows(0).Cells(0).TextBody.AddParagraph("Row - 1, Column - 1")
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Methods

    GetActualHeight()

    Gets the dynamic height of the table.

    Declaration
    float GetActualHeight()
    Returns
    Type Description
    System.Single
    Examples
    //Create instance of PowerPoint presentation
    IPresentation presDoc = Presentation.Create();
    //Opens slide in the presentation
    ISlide slide = presDoc.Slides[0];
    //Open Table in the slide to make changes
    ITable table = slide.Shapes[0] as ITable;
    //Changing the paragraph content in the table
    table.Rows[0].Cells[0].TextBody.AddParagraph("Hello World");
    //Get the dynamic height of the table
    float height=table.GetActualHeight();
    //Save the presentation
    presDoc.Save("Sample.pptx");
    //Close the presentation
    presDoc.Close();

    ///

    Dim presDoc As IPresentation = Presentation.Create()
    ‘Opens slide in the presentation
    Dim slide As ISlide = presDoc.Slides[0]
    ‘Open Table in the slide to make changes
    Dim table As ITable = slide.Shapes[0] as ITable
    ‘Changing the paagraph content in te table
    table.Rows[0].Cells[0].TextBody.AddParagraph("Hello World");
    ‘Get the dynamic height of table
    Dim height As float = table.GetActualHeight()
    ‘Save the presentation
    presDoc.Save("Sample.pptx")
    ‘Close the presentation
    presDoc.Close()
    ///

    InsertColumn(Int32)

    Inserts the column at the specified index position of the table

    Declaration
    void InsertColumn(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The index position to insert the column

    Examples
    //Create instance of PowerPoint presentation
    IPresentation presDoc = Presentation.Create();
    //Add slide to the presentation
    ISlide slide = presDoc.Slides.Add(SlideLayoutType.Blank);
    //Add table to the slide
    ITable table = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200);
    //Insert the column at the specified index position
    table.InsertColumn(1);
    //Save the presentation
    presDoc.Save("Sample.pptx");
    //Close the presentation
    presDoc.Close();
    Dim presDoc As IPresentation = Presentation.Create()
    ‘Add slide to the presentation
    Dim slide As ISlide = presDoc.Slides.Add(SlideLayoutType.Blank)
    ‘Add table to the slide
    Dim table As ITable = slide.Shapes.AddTable(2, 2, 100, 120, 300, 200)
    ‘Insert the column at the specified index position
    table.InsertColumn(1);
    ‘Save the presentation
    presDoc.Save("Sample.pptx")
    ‘Close the presentation
    presDoc.Close()
    ///
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved