Udostępnij za pośrednictwem


Workbook.TableStyles Property (2007 System)

Gets the collection of table styles that are used in the workbook.

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property TableStyles As TableStyles
'Usage
Dim instance As Workbook 
Dim value As TableStyles 

value = instance.TableStyles
[BrowsableAttribute(false)]
public TableStyles TableStyles { get; }
[BrowsableAttribute(false)]
public:
property TableStyles^ TableStyles {
    TableStyles^ get ();
}
public function get TableStyles () : TableStyles

Property Value

Type: TableStyles
A Microsoft.Office.Interop.Excel.TableStyles collection that contains the table styles that are used in the workbook.

Examples

The following code example sets the default style of tables to TableStyleDark11, which is a style available in the TableStyles collection. The example then adds a table to verify the new table style.

This example is for a document-level customization.

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

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace