Skip to main content

IXlRow.CreateCell() Method

Creates a new cell in the row and returns the IXlCell object.

Namespace: DevExpress.Export.Xl

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

NuGet Package: DevExpress.Printing.Core

Declaration

IXlCell CreateCell()

Returns

Type Description
IXlCell

An IXlCell object that is the newly created cell.

Remarks

Note

When you finish working with the IXlCell object, call the Dispose method to release all the resources used by the object. Otherwise, generated content is not written to the output file. You can also modify the IXlCell object within the using statement (Using block in Visual Basic).

Example

The example below demonstrates how to create worksheet cells and set their values. To add data to a cell, assign the required value to the IXlCell.Value property.

// Create a new worksheet.
using (IXlSheet sheet = document.CreateSheet()) {
    // Create the first row in a worksheet.
    using (IXlRow row = sheet.CreateRow()) {

        // Create the cell A1 and specify its value. 
        using (IXlCell cell = row.CreateCell()) {
            cell.Value = "Numeric value:";
        }

        // Create the cell B1 and specify its value.
        using (IXlCell cell = row.CreateCell()) {
            cell.Value = 123.45;
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateCell() 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