Version

Saving a Workbook (Infragistics Excel Engine)

You can save a Workbook object by calling its Save method. However, the workbook must contain at least one visible worksheet when you save it; otherwise, an exception will be thrown.

The following example code demonstrates how to save a Workbook object as an Excel file.

In C#:

Workbook workbook1 = new Workbook();
Worksheet worksheet = workbook1.Worksheets.Add("Sheet1");
// Make some column headers
worksheet.Rows[1].Cells[1].Value = "Morning";
worksheet.Rows[1].Cells[2].Value = "Afternoon";
worksheet.Rows[1].Cells[3].Value = "Evening";
workbook1.Save(outputStream);