Share via


ListObject.TableStyle Property

Definition

Gets or sets the table style.

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

Property Value

An object that represents the table style.

Examples

The following code example adds a ListObject to the Sheet1 sheet. The example then sets the table style of the ListObject, which corresponds to an Excel table, to the Table Style Dark 10 style. The table styles you can set for this property correspond to the table styles that are available in the Excel user interface on the Design tab that appears when a table is selected.

This example is for a document-level customization.

private void SetListObjectStyle()
{            
    Microsoft.Office.Tools.Excel.ListObject myTable = 
        Globals.Sheet1.Controls.AddListObject( 
            Globals.Sheet1.Range["A1", "B3"], "myTable");

    myTable.TableStyle = "TableStyleDark10";
}
Private Sub SetListObjectStyle()        
    Dim myTable As Microsoft.Office.Tools.Excel.ListObject = _
    Globals.Sheet1.Controls.AddListObject( _
        Globals.Sheet1.Range("A1", "B3"), "myTable")

    myTable.TableStyle = "TableStyleDark10"
End Sub

Applies to