Export (0) Print
Expand All
Expand Minimize

Workbook.DefaultTableStyle Property (2007 System)

Gets or sets the table style from the TableStyles property that is used as the default style for tables in the workbook.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

[BrowsableAttribute(false)]
public Object DefaultTableStyle { get; set; }

Property Value

Type: System.Object
The table style from the TableStyles property that is used as the default style for tables in the workbook.

The following code example sets the default style of tables to Table Style Dark 11, which is a style that is available in Excel on the Design tab in the Table Styles group when a table is selected. 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");
}

Community Additions

ADD
Show:
© 2014 Microsoft