Skip to main content
A newer version of this page is available. .

How to: Create a Row

Tip

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T253492.

The example below demonstrates how to create and modify a row in a worksheet. To do this, use the IXlSheet.CreateRow method. To specify where a created row should be located in a worksheet, pass a zero-based row index to the method as a parameter.

// Create a new worksheet.
using (IXlSheet sheet = document.CreateSheet()) 
{
    // Create the third row and set its height to 40 pixels.
    using (IXlRow row = sheet.CreateRow(2))
    {
        row.HeightInPixels = 40;
    }
}

Note

The number of rows in a worksheet is permanently fixed and depends on the output file format (1,048,576 rows for XLSX and CSV files, and 65,536 rows for XLS files). Note that you can use the IXlDocumentOptions.MaxRowCount property to obtain the maximum number of rows supported by the file format to which the document is exported.