Other API Samples

Live SpreadsheetGear API Samples

Workbook Saving Excel 97-2003 (*.xls)

This sample demonstrates saving to the Excel 2007-2019 Excel 97-2003 (*.xls) file format using the FileFormat.Excel8 enumeration option.

// Create a new workbook and some local variables for convenience.
SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook();
SpreadsheetGear.IWorksheet worksheet = workbook.Worksheets["Sheet1"];
SpreadsheetGear.IRange cells = worksheet.Cells;

// Rename the worksheet.
worksheet.Name = "My Worksheet";

// Add some cell data.
cells["A1"].Value = "Hello World!";

// Save to Excel 97-2003 (*.xls) file.
workbook.SaveAs(@"c:\path\to\workbook.xlsx", SpreadsheetGear.FileFormat.Excel8);
Run This Sample
Download File

Download an Excel 97-2003 (*.xls) file with the results of this sample.