Skip to main content
Row

TableStyleElement.StripeSize Property

Specifies the number of table rows or columns displayed as odd and even stripes in the table.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

int StripeSize { get; set; }

Property Value

Type Description
Int32

An integer that specifies the number of table rows or columns displayed in row or column stripes in the table.

Remarks

To improve the readability of a table, you can apply alternating shading for rows or columns in your table.

  • Striped Rows Format

    To apply banding to rows in a table, set the Table.ShowTableStyleRowStripes property to true and the Table.ShowTableStyleColumnStripes property to false. This formatting is used in tables by default.

    To change format of alternate row stripes, modify the TableStyleElementType.FirstRowStripe and TableStyleElementType.SecondRowStripe elements of the style applied to a table. The StripeSize property of these table style elements allows you to specify a number of table rows to be included into odd and even row stripes.

    TableStyle tableStyle = workbook.TableStyles[BuiltInTableStyleId.TableStyleMedium16].Duplicate();
    tableStyle.BeginUpdate();
    try {
        tableStyle.TableStyleElements[TableStyleElementType.FirstRowStripe].StripeSize = 2;
        tableStyle.TableStyleElements[TableStyleElementType.SecondRowStripe].StripeSize = 1;
    }
    finally {
        tableStyle.EndUpdate();
    }
    
    Table newTable = workbook.Worksheets.ActiveWorksheet.Tables.Add(spreadsheetControl1.Selection, true);
    newTable.Style = tableStyle;
    

    This image demonstrates the result of executing the code above.

    SpreadsheetControl_TableRowsBanding

  • Striped Columns Format

    To apply banding to columns in a table, set the Table.ShowTableStyleColumnStripes property to true and the Table.ShowTableStyleRowStripes property to false.

    To change the format of alternate column stripes, modify the TableStyleElementType.FirstColumnStripe and TableStyleElementType.SecondColumnStripe elements of the style applied to a table. The StripeSize property of these table style elements allows you to specify the number of table columns to be displayed as odd and even column stripes.

    TableStyle tableStyle = workbook.TableStyles[BuiltInTableStyleId.TableStyleMedium16].Duplicate();
    tableStyle.BeginUpdate();
    try {
        tableStyle.TableStyleElements[TableStyleElementType.FirstColumnStripe].StripeSize = 1;
        tableStyle.TableStyleElements[TableStyleElementType.SecondColumnStripe].StripeSize = 2;
    }
    finally {
        tableStyle.EndUpdate();
    }
    
    Table newTable = workbook.Worksheets.ActiveWorksheet.Tables.Add(spreadsheetControl1.Selection, true);
    newTable.Style = tableStyle;
    
    newTable.ShowTableStyleColumnStripes = true;
    newTable.ShowTableStyleRowStripes = false;
    

    This image demonstrates the result of executing the code above.

    SpreadsheetControl_TableColumnsBanding

Note

Use the StripeSize property of the FirstRowStripe, SecondRowStripe, FirstColumnStripe or SecondColumnStripe table style elements only. If you try so set this property for any other table style element, an exception occurs.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the StripeSize 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.

See Also