Expand Minimize
This topic has not yet been rated - Rate this topic

WorkbookBase.DefaultTableStyle Property

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.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
public Object DefaultTableStyle { get; set; }

Property Value

Type: 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");
}
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.