Back to Devexpress

Table.ShowTableStyleLastColumn Property

officefileapi-devexpress-dot-spreadsheet-dot-table-ffafe599.md

latest4.4 KB
Original Source

Table.ShowTableStyleLastColumn Property

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

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

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

Property Value

TypeDescription
Boolean

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

|

Remarks

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

If the ShowTableStyleLastColumn property is set to false , the last table is formated just as other columns of the table.

The following example demonstrates creation of a table style with special formatting for a table’s last 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.LastColumn].Fill.BackgroundColor = Color.FromArgb(248, 164, 94);
    tbstElements[TableStyleElementType.LastColumn].Borders.SetAllBorders(Color.FromArgb(151, 71, 6), BorderLineStyle.Thin);
    tbstElements[TableStyleElementType.LastHeaderCell].Fill.BackgroundColor = Color.FromArgb(252, 213, 180);
    tbstElements[TableStyleElementType.LastTotalCell].Fill.BackgroundColor = Color.FromArgb(244, 117, 12);
}
finally {
    tableStyle.EndUpdate();
}

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

newTable.ShowTableStyleLastColumn = 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.LastColumn).Fill.BackgroundColor = Color.FromArgb(248, 164, 94)
    tbstElements(TableStyleElementType.LastColumn).Borders.SetAllBorders(Color.FromArgb(151, 71, 6), BorderLineStyle.Thin)
    tbstElements(TableStyleElementType.LastHeaderCell).Fill.BackgroundColor = Color.FromArgb(252, 213, 180)
    tbstElements(TableStyleElementType.LastTotalCell).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.ShowTableStyleLastColumn = True

See Also

Spreadsheet Tables

Table Interface

Table Members

DevExpress.Spreadsheet Namespace