Articles in this section

How to serialize or deserialize in WinForms Spreadsheet?

Serialization and deserialization in spreadsheet

WinForms Spreadsheet (SfSpreadsheet) provides support to serialize and deserialize the workbook using XlsIO. 

Serialization:

For serialization, you can use SaveAsXml method of IWorkbook.

// Serialize
MemoryStream serializedBinary = new MemoryStream();
this.Spreadsheet.Workbook.SaveAsXml(serializedBinary, ExcelXmlSaveType.MSExcel);

Deserialization:


For Deserialization, you can use OpenFromXml method of IWorkbook.

// Deserialize
serializedBinary.Seek(0, SeekOrigin.Begin);
ExcelEngine engine = new ExcelEngine();
IWorkbook workbook = engine.Excel.Workbooks.OpenFromXml(serializedBinary, ExcelXmlOpenType.MSExcel);
this.Spreadsheet.Open(workbook);

Samples:

WPF

WinForms

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied