Back to Devexpress

Table.ShowTableStyleFirstColumn Property

officefileapi-devexpress-dot-spreadsheet-dot-table-78957c98.md

latest5.8 KB
Original Source

Table.ShowTableStyleFirstColumn Property

Indicates whether special formatting should be applied to the first column of the table.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
bool ShowTableStyleFirstColumn { get; set; }
vb
Property ShowTableStyleFirstColumn As Boolean

Property Value

TypeDescription
Boolean

true , to apply special formatting to the first column of the table; otherwise, false.

|

Remarks

If the ShowTableStyleFirstColumn property is set to true , the appearance of the table’s first column is specified by the following elements of the style applied to the table.

If the ShowTableStyleFirstColumn property is set to false , the first table is formated identically to the other columns of the table.

The following example demonstrates the creation of a table style with special formatting for the table’s first column and how to apply this formatting to the table.

csharp
using DevExpress.Spreadsheet;
// ...

TableStyle tableStyle = workbook.TableStyles[BuiltInTableStyleId.TableStyleLight15].Duplicate();

tableStyle.BeginUpdate();
try {
    TableStyleElements tbstElements = tableStyle.TableStyleElements;

    tbstElements[TableStyleElementType.FirstColumn].Fill.BackgroundColor = Color.FromArgb(248, 164, 94);
    tbstElements[TableStyleElementType.FirstColumn].Borders.SetAllBorders(Color.FromArgb(151, 71, 6), BorderLineStyle.Thin);
    tbstElements[TableStyleElementType.FirstHeaderCell].Fill.BackgroundColor = Color.FromArgb(252, 213, 180);
    tbstElements[TableStyleElementType.FirstTotalCell].Fill.BackgroundColor = Color.FromArgb(244, 117, 12);
}
finally {
    tableStyle.EndUpdate();
}

Table newTable = workbook.Worksheets.ActiveWorksheet.Tables.Add(spreadsheetControl1.Selection, true);
newTable.Style = tableStyle;

newTable.ShowTableStyleFirstColumn = true;
vb
Imports DevExpress.Spreadsheet
' ...

Dim tableStyle As TableStyle = workbook.TableStyles(BuiltInTableStyleId.TableStyleLight15).Duplicate()

tableStyle.BeginUpdate()
Try
    Dim tbstElements As TableStyleElements = tableStyle.TableStyleElements

    tbstElements(TableStyleElementType.FirstColumn).Fill.BackgroundColor = Color.FromArgb(248, 164, 94)
    tbstElements(TableStyleElementType.FirstColumn).Borders.SetAllBorders(Color.FromArgb(151, 71, 6), BorderLineStyle.Thin)
    tbstElements(TableStyleElementType.FirstHeaderCell).Fill.BackgroundColor = Color.FromArgb(252, 213, 180)
    tbstElements(TableStyleElementType.FirstTotalCell).Fill.BackgroundColor = Color.FromArgb(244, 117, 12)
Finally
    tableStyle.EndUpdate()
End Try

Dim newTable As Table = workbook.Worksheets.ActiveWorksheet.Tables.Add(spreadsheetControl1.Selection, True)
newTable.Style = tableStyle

newTable.ShowTableStyleFirstColumn = True

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ShowTableStyleFirstColumn property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

spreadsheet-document-api-examples-part2/CS/SpreadsheetDocServerAPIPart2/CodeExamples/TableActions.cs#L108

csharp
// Format the first column in the table.
table.ShowTableStyleFirstColumn = true;
worksheet.Visible = true;

spreadsheet-document-api-examples-part2/VB/SpreadsheetDocServerAPIPart2/CodeExamples/TableActions.vb#L102

vb
' Format the first column in the table.
table.ShowTableStyleFirstColumn = True
worksheet.Visible = True

See Also

Spreadsheet Tables

Table Interface

Table Members

DevExpress.Spreadsheet Namespace