A newer version of this page is available. Switch to the current version.

Modify Documents in Code

This topic describes how to modify a document in the DevExpress.Web.ASPxSpreadsheet.

Follow the steps below to modify a document on the server side:

  1. Call the client PerformCallback method to initiate a callback to the server side to access the document model.

  2. Use the Spreadsheet Document API in the Callback event handler to modify the document on the server side.

First, use the Document property to obtain an IWorkbook. This interface encapsulates the spreadsheet document API.

IWorkbook workbook = ASPxSpreadsheet1.Document;

Use the following APIs to access a worksheet:

  • The Worksheets property - Provides access to a worksheet by its index:

    Worksheet worksheet = workbook.Worksheets[0];
  • The ActiveWorksheet property - Provides access to an active worksheet:

    Worksheet worksheet = workbook.Worksheets.ActiveWorksheet; 


You should reference the DevExpress.Office.20.2.Core assembly.

The Rows and Columns properties allow you to access rows or columns in a worksheet (Rows and Columns).

You can access cell ranges to modify a document’s appearance, formulas, and cell formats. Use the Worksheet object to access the cell range(s):

Range rangeA1B5 = worksheet["A1:B5"];

Online Examples