Compartilhar via


WorkbookBase.DefaultTableStyle Property

Definition

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

public:
 property System::Object ^ DefaultTableStyle { System::Object ^ get(); void set(System::Object ^ value); };
public object DefaultTableStyle { get; set; }
member this.DefaultTableStyle : obj with get, set
Public Property DefaultTableStyle As Object

Property Value

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

Examples

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");
}
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