Freigeben über


ListObject.TableStyle Property

Gets or sets the table style.

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

Syntax

'Declaration
Property TableStyle As Object
Object TableStyle { get; set; }

Property Value

Type: System.Object
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 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
private void SetListObjectStyle()
{            
    Microsoft.Office.Tools.Excel.ListObject myTable = 
        Globals.Sheet1.Controls.AddListObject( 
            Globals.Sheet1.Range["A1", "B3"], "myTable");

    myTable.TableStyle = "TableStyleDark10";
}

.NET Framework Security

See Also

Reference

ListObject Interface

Microsoft.Office.Tools.Excel Namespace