Skip to main content

IXlTableStyleInfo.ShowColumnStripes Property

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

Namespace: DevExpress.Export.Xl

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

Declaration

bool ShowColumnStripes { get; set; }

Property Value

Type Description
Boolean

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

Remarks

To apply banding to columns in a table, set the ShowColumnStripes property to true and the IXlTableStyleInfo.ShowRowStripes property to false.

XlExport_Tables_BandedColumnFormatting

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