Skip to main content

IXlTableStyleInfo.ShowRowStripes Property

Gets or sets a value indicating whether alternate shading should be applied to the table rows.

Namespace: DevExpress.Export.Xl

Assembly: DevExpress.Printing.v24.1.Core.dll

NuGet Package: DevExpress.Printing.Core

Declaration

bool ShowRowStripes { get; set; }

Property Value

Type Description
Boolean

true, to apply striped row formatting to the table; otherwise, false.

Remarks

To apply banding to rows in a table, set the ShowRowStripes property to true and the IXlTableStyleInfo.ShowColumnStripes property to false. This formatting is used in tables by default.

XlExport_Tables_BandedRowFormatting

Example

Note

A complete sample project is available at https://github.com/DevExpress-Examples/excel-export-api-examples

IXlTable table;
// Specify an array containing column headings for tables.
string[] columnNames = new string[] { "Product", "Category", "Amount" };

// Create the row containing the table title.
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Disable banded rows" }, XlCellFormatting.Title);
sheet.SkipRows(1);

// Start generating the table with a header row displayed.
using (IXlRow row = sheet.CreateRow())
{
    table = row.BeginTable(columnNames, true);
    // Disable banded row formatting for the table.
    table.Style.ShowRowStripes = false;
}
// Generate table rows and populate them with data.
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Camembert Pierrot", "Dairy Products", 17000 }, null);
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Gnocchi di nonna Alice", "Grains/Cereals", 15500 }, null);
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Mascarpone Fabioli", "Dairy Products", 15000 }, null);
// Create the last table row and finish the table.
// The total row is not displayed for the table. 
using (IXlRow row = sheet.CreateRow())
{
    row.BulkCells(new object[] { "Ravioli Angelo", "Grains/Cereals", 12500 }, null);
    row.EndTable(table, false);
}
sheet.SkipRows(1);

// Create the row containing the table title.
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Enable banded columns" }, XlCellFormatting.Title);
sheet.SkipRows(1);

// Start generating the table with a header row displayed.
using (IXlRow row = sheet.CreateRow())
{
    table = row.BeginTable(columnNames, true);
    // Apply banded column formatting to the table.
    table.Style.ShowRowStripes = false;
    table.Style.ShowColumnStripes = true;
}
// Generate table rows and populate them with data.
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Camembert Pierrot", "Dairy Products", 17000 }, null);
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Gnocchi di nonna Alice", "Grains/Cereals", 15500 }, null);
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Mascarpone Fabioli", "Dairy Products", 15000 }, null);
// Create the last table row and finish the table.
// The total row is not displayed for the table. 
using (IXlRow row = sheet.CreateRow())
{
    row.BulkCells(new object[] { "Ravioli Angelo", "Grains/Cereals", 12500 }, null);
    row.EndTable(table, false);
}
sheet.SkipRows(1);

// Create the row containing the table title.
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Highlight first column" }, XlCellFormatting.Title);
sheet.SkipRows(1);

// Start generating the table with a header row displayed.
using (IXlRow row = sheet.CreateRow())
{
    table = row.BeginTable(columnNames, true);
    // Display special formatting for the first column of the table.
    table.Style.ShowFirstColumn = true;
}
// Generate table rows and populate them with data.
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Camembert Pierrot", "Dairy Products", 17000 }, null);
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Gnocchi di nonna Alice", "Grains/Cereals", 15500 }, null);
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Mascarpone Fabioli", "Dairy Products", 15000 }, null);
// Create the last table row and finish the table.
// The total row is not displayed for the table. 
using (IXlRow row = sheet.CreateRow())
{
    row.BulkCells(new object[] { "Ravioli Angelo", "Grains/Cereals", 12500 }, null);
    row.EndTable(table, false);
}
sheet.SkipRows(1);

// Create the row containing the table title.
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Highlight last column" }, XlCellFormatting.Title);
sheet.SkipRows(1);

// Start generating the table with a header row displayed.
using (IXlRow row = sheet.CreateRow())
{
    table = row.BeginTable(columnNames, true);
    // Display special formatting for the last column of the table.
    table.Style.ShowLastColumn = true;
}
// Generate table rows and populate them with data.
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Camembert Pierrot", "Dairy Products", 17000 }, null);
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Gnocchi di nonna Alice", "Grains/Cereals", 15500 }, null);
using (IXlRow row = sheet.CreateRow())
    row.BulkCells(new object[] { "Mascarpone Fabioli", "Dairy Products", 15000 }, null);
// Create the last table row and finish the table.
// The total row is not displayed for the table. 
using (IXlRow row = sheet.CreateRow())
{
    row.BulkCells(new object[] { "Ravioli Angelo", "Grains/Cereals", 12500 }, null);
    row.EndTable(table, false);
}
See Also