Skip to main content

IXlRow.BulkCells(IEnumerable, XlCellFormatting) Method

Creates cells with the specified values and format characteristics.

Namespace: DevExpress.Export.Xl

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

NuGet Package: DevExpress.Printing.Core

Declaration

void BulkCells(
    IEnumerable values,
    XlCellFormatting formatting
)

Parameters

Name Type Description
values IEnumerable

An object exposing the System.Collections.IEnumerable interface that provides values for cells to be created.

If the values parameter is null, a System.ArgumentNullException exception occurs.

formatting XlCellFormatting

An XlCellFormatting object that specifies formatting settings be applied to the created cells. If null, no special formatting is applied.

Example

The example below demonstrates how to use the IXlRow.BulkCells method to quickly generate multiple non-empty cells in a row that share the same formatting settings. This method can be useful if you wish, for example, to create the header row for your table. To generate a bunch of empty cells and apply the same format to them in a single step, use the IXlRow.BlankCells method.

For more information on how to create and format cells in a worksheet, see the Cells and Formatting example sections.

string[] columnLabels = new string[] { "State", "Sales", "Profit", "Market Share" };

// Create a worksheet. 
using (IXlSheet sheet = document.CreateSheet())
{
    // Specify formatting settings for the header row.
    XlCellFormatting headerRowFormatting = new XlCellFormatting();
    headerRowFormatting.Font = new XlFont();
    headerRowFormatting.Font.Name = "Century Gothic";
    headerRowFormatting.Font.SchemeStyle = XlFontSchemeStyles.None;
    headerRowFormatting.Font.Color = XlColor.FromTheme(XlThemeColor.Light1, 0.0);
    headerRowFormatting.Fill = XlFill.SolidFill(XlColor.FromTheme(XlThemeColor.Accent1, 0.0));

    // Create the header row.
    using (IXlRow row = sheet.CreateRow())
        {
        // Set the row height.
        row.HeightInPixels = 25;
        // Create the required cells in the header row:  
        // assign values of the "columnLabels" array to these cells and apply specific formatting settings to them.
        row.BulkCells(columnLabels, headerRowFormatting);
        }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the BulkCells(IEnumerable, XlCellFormatting) method.

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