IXlTable.Style Property
Provides access to the table style options.
Namespace: DevExpress.Export.Xl
Assembly: DevExpress.Printing.v24.2.Core.dll
NuGet Package: DevExpress.Printing.Core
#Declaration
IXlTableStyleInfo Style { get; }
#Property Value
Type | Description |
---|---|
IXl |
An IXl |
#Remarks
Use the IXlTableStyleInfo object’s members to format a table by using one of the predefined table styles (IXlTableStyleInfo.Name) and specify which elements of the table should have this style applied (IXlTableStyleInfo.ShowRowStripes, IXlTableStyleInfo.ShowColumnStripes, IXlTableStyleInfo.ShowFirstColumn, IXlTableStyleInfo.ShowLastColumn).
For more information on how to apply a table style and specify its options, refer to the How to: Apply a Table Style example.
#Example
Note
A complete sample project is available at https://github.
IXlTable table;
// Specify an array containing column headings for a table.
string[] columnNames = new string[] { "Product", "Category", "Amount" };
// Create the first row in the worksheet from which the table starts.
using (IXlRow row = sheet.CreateRow())
{
// Start generating the table with a header row displayed.
table = row.BeginTable(columnNames, true);
// Apply the table style.
table.Style.Name = XlBuiltInTableStyleId.Dark7;
}
// 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);
}