Skip to main content

IXlCell Interface

Represents a single cell in a worksheet.

Namespace: DevExpress.Export.Xl

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

NuGet Package: DevExpress.Printing.Core

Declaration

public interface IXlCell :
    IDisposable

The following members return IXlCell objects:

Remarks

Cells are constituent elements of a worksheet. An individual cell is represented by the object that implements the IXlCell interface. To create a worksheet cell, use the IXlRow.CreateCell method.

Each cell holds a single piece of data - the cell value. To get access to a cell value, use the IXlCell.Value property.

A cell can also contain a formula that calculates the cell value dynamically. To specify a cell formula, use the IXlCell.SetFormula method .

You can format cells to improve worksheet appearance. To do this, use the IXlCell.ApplyFormatting method or the IXlCell.Formatting property. For details on how to create, manage and format worksheet cells, see the Cells and Formatting sections of examples.

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;
        }
    }
}
See Also