WorkbookBase.TableStyles Property

Definition

Gets the collection of table styles that are used in the workbook.

public:
 property Microsoft::Office::Interop::Excel::TableStyles ^ TableStyles { Microsoft::Office::Interop::Excel::TableStyles ^ get(); };
public Microsoft.Office.Interop.Excel.TableStyles TableStyles { get; }
member this.TableStyles : Microsoft.Office.Interop.Excel.TableStyles
Public ReadOnly Property TableStyles As TableStyles

Property Value

A Microsoft.Office.Interop.Excel.TableStyles collection that contains the table styles that are used in the workbook.

Examples

The following code example sets the default style of tables to TableStyleDark11, which is a style available in the TableStyles collection. The example then adds a table to verify the new table style.

This example is for a document-level customization.

private void SetTableStyle()
{
    this.DefaultTableStyle = this.TableStyles["TableStyleDark11"];

    // Add a table to verify the new default table style
    Microsoft.Office.Tools.Excel.ListObject myTable =
    Globals.Sheet1.Controls.AddListObject(
        Globals.Sheet1.Range["A1", "B3"], "myTable");
}
Private Sub SetTableStyle()
    Me.DefaultTableStyle = Me.TableStyles("TableStyleDark11")

    ' Add a table to verify the new default table style
    Dim myTable As Microsoft.Office.Tools.Excel.ListObject = _
    Globals.Sheet1.Controls.AddListObject( _
        Globals.Sheet1.Range("A1", "B3"), "myTable")
End Sub

Applies to