WorkbookBase.TableStyles Property
Gets the collection of table styles that are used 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)
Syntax
'Declaration
Public ReadOnly Property TableStyles As TableStyles
Get
public TableStyles TableStyles { get; }
Property Value
Type: Microsoft.Office.Interop.Excel.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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.