//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); //ToJson&FromJson can be used in combination with spreadjs product //Document Solutions for Excel import an excel file. //Change the path to real source file path. string source = "source.xlsx"; workbook.Open(source); //Open the same user file GrapeCity.Documents.Excel.Workbook new_workbook = new GrapeCity.Documents.Excel.Workbook(); new_workbook.Open(source); foreach (IWorksheet worksheet in workbook.Worksheets) { //Do any change of worksheet //... //Document Solutions for Excel export a worksheet to a json string. string json = worksheet.ToJson(); //Use the json string to initialize spreadjs product. //Product spreadjs will show the excel file contents. //Use spreadjs product export a json string of worksheet. //Document Solutions for Excel use the json string to update content of the corresponding worksheet. new_workbook.Worksheets[worksheet.Name].FromJson(json); } //Document Solutions for Excel export workbook to an excel file. //Change the path to real export file path. string export = "export.xlsx"; new_workbook.Save(export);
' Create a new Workbook Dim workbook As New Workbook 'ToJson&FromJson can be used in combination with spreadjs product 'Document Solutions for Excel import an excel file. 'Change the path to real source file path. Dim source = "source.xlsx" workbook.Open(source) 'Open the same user file Dim newWorkbook As New Excel.Workbook newWorkbook.Open(source) For Each worksheet In workbook.Worksheets 'Do any change of worksheet '... 'Document Solutions for Excel export a worksheet to a json string. Dim json As String = worksheet.ToJson() 'Use the json string to initialize spread.sheets product. 'Product spread.sheets will show the excel file contents. 'Use spread.sheets product export a json string of worksheet. 'Document Solutions for Excel use the json string to update content of the corresponding worksheet. newWorkbook.Worksheets(worksheet.Name).FromJson(json) Next 'Document Solutions for Excel export workbook to an excel file. 'Change the path to real export file path. Dim export = "export.xlsx" newWorkbook.Save(export)