WorkbookBase.TableStyles 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得活頁簿中使用之表格樣式的集合。
public:
property Microsoft::Office::Interop::Excel::TableStyles ^ TableStyles { Microsoft::Office::Interop::Excel::TableStyles ^ get(); };
public Microsoft.Office.Interop.Excel.TableStyles TableStyles { get; }
member this.TableStyles : Microsoft.Office.Interop.Excel.TableStyles
Public ReadOnly Property TableStyles As TableStyles
屬性值
Microsoft.Office.Interop.Excel.TableStyles 集合,其中包含活頁簿中使用的表格樣式。
範例
下列程式代碼範例會將數據表 TableStyleDark11
的預設樣式設定為 ,這是集合中 TableStyles 可用的樣式。 然後,此範例會新增數據表來驗證新的表格樣式。
此範例適用於檔層級自定義。
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