Class TableStyleCollection
A read-first collection of TableStyle objects available
in the presentation. Provides lookup by ID or name.
Maps to the OOXML tblStyleLst element.
Inherited Members
Namespace: DRIT.Presentation
Assembly: DRIT.Presentation.dll
Syntax
public class TableStyleCollection : IList<TableStyle>, ICollection<TableStyle>, IEnumerable<TableStyle>, IEnumerable
Constructors
TableStyleCollection()
Initializes a new empty collection.
Declaration
public TableStyleCollection()
Properties
Count
Gets the number of styles in the collection.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
DefaultStyleId
Gets or sets the default table style ID.
Declaration
public Guid? DefaultStyleId { get; set; }
Property Value
| Type | Description |
|---|---|
| Guid? |
IsReadOnly
Gets a value indicating whether the collection is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| bool |
this[int]
Gets or sets the table style at the specified index.
Declaration
public TableStyle this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |
Property Value
| Type | Description |
|---|---|
| TableStyle |
Methods
Add(TableStyle)
Adds a table style to the collection.
Declaration
public void Add(TableStyle item)
Parameters
| Type | Name | Description |
|---|---|---|
| TableStyle | item |
Add(Guid, string)
Creates and adds a table style with the specified ID and name.
Declaration
public TableStyle Add(Guid id, string name)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | |
| string | name |
Returns
| Type | Description |
|---|---|
| TableStyle |
Clear()
Removes all styles from the collection.
Declaration
public void Clear()
Contains(TableStyle)
Determines whether the collection contains the specified style.
Declaration
public bool Contains(TableStyle item)
Parameters
| Type | Name | Description |
|---|---|---|
| TableStyle | item |
Returns
| Type | Description |
|---|---|
| bool |
CopyTo(TableStyle[], int)
Copies the styles to an array starting at the specified index.
Declaration
public void CopyTo(TableStyle[] array, int arrayIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| TableStyle[] | array | |
| int | arrayIndex |
FindById(Guid)
Finds a table style by its unique identifier.
Declaration
public TableStyle FindById(Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | The style GUID to search for. |
Returns
| Type | Description |
|---|---|
| TableStyle | The matching style, or |
FindByName(string)
Finds a table style by its display name (case-insensitive).
Declaration
public TableStyle FindByName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The style name to search for. |
Returns
| Type | Description |
|---|---|
| TableStyle | The matching style, or |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<TableStyle> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<TableStyle> |
IndexOf(TableStyle)
Returns the index of the specified style, or -1 if not found.
Declaration
public int IndexOf(TableStyle item)
Parameters
| Type | Name | Description |
|---|---|---|
| TableStyle | item |
Returns
| Type | Description |
|---|---|
| int |
Insert(int, TableStyle)
Inserts a table style at the specified index.
Declaration
public void Insert(int index, TableStyle item)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | |
| TableStyle | item |
Remove(TableStyle)
Removes the first occurrence of the specified style.
Declaration
public bool Remove(TableStyle item)
Parameters
| Type | Name | Description |
|---|---|---|
| TableStyle | item |
Returns
| Type | Description |
|---|---|
| bool |
RemoveAt(int)
Removes the style at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |