menu

Document Processing

Interface ITables - FileFormats API Reference | Syncfusion

    Show / Hide Table of Contents

    Interface ITables

    Represents a collection of ITable instance.

    Namespace: Syncfusion.Presentation
    Assembly: Syncfusion.Presentation.Base.dll
    Syntax
    public interface ITables : IEnumerable<ITable>, IEnumerable

    Properties

    Count

    Gets the number of elements in the table collection. Read-only.

    Declaration
    int Count { get; }
    Property Value
    Type Description
    System.Int32

    The total count of the table.

    Examples
    //Create instance of PowerPoint presentation
    IPresentation presentation = Presentation.Create();
    //Add slide to the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Create instance to hold table collection in a slide
    ITables tables = slide.Tables;
    //Add tables to the table collection
    ITable table = tables.AddTable(2, 2, 100, 120, 300, 200);
    tables.AddTable(1, 1, 300, 200, 100, 100);
    tables.AddTable(1, 1, 400, 30, 100, 100);
    //Get the count of table collection, it is read only
    int count = tables.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)
    'Create instance to hold table collection in a slide
    Dim tables As ITables = slide.Tables
    'Add tables to the table collection
    Dim table As ITable = tables.AddTable(2, 2, 100, 120, 300, 200)
    tables.AddTable(1, 1, 300, 200, 100, 100)
    tables.AddTable(1, 1, 400, 30, 100, 100)
    'Get the count of table collection, it is read only
    Dim count As Integer = tables.Count
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Item[Int32]

    Gets a ITable instance at specified index from the collection. Read-only.

    Declaration
    ITable this[int index] { get; }
    Parameters
    Type Name Description
    System.Int32 index

    Determines the table index.

    Property Value
    Type Description
    ITable

    Returns an ITable instance.

    Examples
    //Create instance of PowerPoint presentation
    IPresentation presentation = Presentation.Create();
    //Add slide to the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Create instance to hold table collection in a slide
    ITables tables = slide.Tables;
    //Add tables to the table collection
    ITable table = tables.AddTable(2, 2, 100, 120, 300, 200);
    tables.AddTable(1, 1, 300, 200, 100, 100);
    tables.AddTable(1, 1, 400, 30, 100, 100);
    //Get the specific table from the collection using index, read only
    ITable _table = tables[1];
    //Set the built-in 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)
    'Create instance to hold table collection in a slide
    Dim tables As ITables = slide.Tables
    'Add tables to the table collection
    Dim table As ITable = tables.AddTable(2, 2, 100, 120, 300, 200)
    tables.AddTable(1, 1, 300, 200, 100, 100)
    tables.AddTable(1, 1, 400, 30, 100, 100)
    'Get the specific table from the collection using index, read only
    Dim _table As ITable = tables(1)
    'Set the built-in style for the table
    _table.BuiltInStyle = BuiltInTableStyle.MediumStyle2Accent6
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Methods

    AddTable(Int32, Int32, Double, Double, Double, Double)

    Adds a table to the shape collection with the specified number of rows and columns. The valid range is 1 to 75.

    Declaration
    ITable AddTable(int rowCount, int columnCount, double left, double top, double width, double height)
    Parameters
    Type Name Description
    System.Int32 rowCount

    Specifies the row count of the table. The valid range is 1 to 75.

    System.Int32 columnCount

    Specifies the column count of the table. The valid range is 1 to 75.

    System.Double left

    Represents the left position, in points. The Left value ranges from -169056 to 169056.

    System.Double top

    Represents the top position, in points. The Top value ranges from -169056 to 169056.

    System.Double width

    Represents the width, in points. The Width value ranges from 0 to 169056.

    System.Double height

    Represents the height, in points. The Height value ranges from 0 to 169056.

    Returns
    Type Description
    ITable

    Returns the ITable instance that represents the newly created table.

    Examples
    //Create instance of PowerPoint presentation
    IPresentation presentation = Presentation.Create();
    //Add slide to the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Create instance to hold table collection in a slide
    ITables tables = slide.Tables;
    //Add tables to the table collection
    ITable table = tables.AddTable(2, 2, 100, 120, 300, 200);
    //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)
    'Create instance to hold table collection in a slide
    Dim tables As ITables = slide.Tables
    'Add tables to the table collection
    Dim table As ITable = tables.AddTable(2, 2, 100, 120, 300, 200)
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    IndexOf(ITable)

    Returns the zero-based index of the first occurrence of the ITable instance within the collection.

    Declaration
    int IndexOf(ITable table)
    Parameters
    Type Name Description
    ITable table

    The ITable instance to locate in the collection.

    Returns
    Type Description
    System.Int32

    Returns the zero-based index of the first occurrence of table 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);
    //Create instance to hold table collection in a slide
    ITables tables = slide.Tables;
    //Add tables to the table collection
    ITable table = tables.AddTable(2, 2, 100, 120, 300, 200);
    tables.AddTable(1, 1, 300, 200, 100, 100);
    tables.AddTable(1, 1, 400, 30, 100, 100);
    //Get the index of a specific table
    int index = tables.IndexOf(table);
    //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)
    'Create instance to hold table collection in a slide
    Dim tables As ITables = slide.Tables
    'Add tables to the table collection
    Dim table As ITable = tables.AddTable(2, 2, 100, 120, 300, 200)
    tables.AddTable(1, 1, 300, 200, 100, 100)
    tables.AddTable(1, 1, 400, 30, 100, 100)
    'Get the index of a specific table
    Dim index As Integer = tables.IndexOf(table)
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    Remove(ITable)

    Removes the first occurrence of a specified table from the table collection.

    Declaration
    void Remove(ITable table)
    Parameters
    Type Name Description
    ITable table

    The table 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);
    //Create instance to hold table collection in a slide
    ITables tables = slide.Tables;
    //Add tables to the table collection
    ITable table = tables.AddTable(2, 2, 100, 120, 300, 200);
    tables.AddTable(1, 1, 300, 200, 100, 100);
    tables.AddTable(1, 1, 400, 30, 100, 100);
    //Get the specific table from the collection using index, read only
    ITable _table = tables[1];
    //Remove a particular table instance
    tables.Remove(_table);
    //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)
    'Create instance to hold table collection in a slide
    Dim tables As ITables = slide.Tables
    'Add tables to the table collection
    Dim table As ITable = tables.AddTable(2, 2, 100, 120, 300, 200)
    tables.AddTable(1, 1, 300, 200, 100, 100)
    tables.AddTable(1, 1, 400, 30, 100, 100)
    'Get the specific table from the collection using index, read only
    Dim _table As ITable = tables(1)
    'Remove a particular table instance
    tables.Remove(_table)
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()

    RemoveAt(Int32)

    Removes the table at the specified index of the table collection.

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

    The zero-based index of the element to be removed.

    Examples
    //Create instance of PowerPoint presentation
    IPresentation presentation = Presentation.Create();
    //Add slide to the presentation
    ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
    //Create instance to hold table collection in a slide
    ITables tables = slide.Tables;
    //Add tables to the table collection
    ITable table = tables.AddTable(2, 2, 100, 120, 300, 200);
    tables.AddTable(1, 1, 300, 200, 100, 100);
    //Remove table using index position
    tables.RemoveAt(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)
    'Create instance to hold table collection in a slide
    Dim tables As ITables = slide.Tables
    'Add tables to the table collection
    Dim table As ITable = tables.AddTable(2, 2, 100, 120, 300, 200)
    tables.AddTable(1, 1, 300, 200, 100, 100)
    'Remove table using index position
    tables.RemoveAt(1)
    'Save the presentation
    presentation__1.Save("Sample.pptx")
    'Close the presentation
    presentation__1.Close()
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved