Other API Samples

Live SpreadsheetGear API Samples

Workbook Saving Workbook Encryption

SpreadsheetGear supports reading and writing encrypted workbooks with Agile Encryption used by Excel 2013 and later, including default SHA-512 encryption for workbooks.

// 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 to Open XML (*.xlsx) file.
    SpreadsheetGear.FileFormat.OpenXMLWorkbook, "MyPassword1234");
Run This Sample
Download File

Download an Excel Open XML Workbook (*.xlsx) file with the results of this sample.