Skip to content

Commit

Permalink
Update Program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohan2401 authored Dec 13, 2024
1 parent f18bb80 commit 8267b36
Showing 1 changed file with 4 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Syncfusion.XlsIO;
using Syncfusion.XlsIO;
using System;
using System.IO;

Expand All @@ -16,32 +16,14 @@ static void Main(string[] args)
IWorkbook workbook = application.Workbooks.Open(inputStream);
IWorksheet worksheet = workbook.Worksheets[0];

#region save as JSON
//Saves the workbook to a JSON filestream, as schema by default
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Excel-Workbook-To-JSON-as-schema-default.json"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAsJson(outputStream);

//Saves the workbook to a JSON filestream as schema
FileStream stream1 = new FileStream(Path.GetFullPath("Output/Excel-Workbook-To-JSON-as-schema.json"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAsJson(stream1, true);
#endregion
FileStream jsonWithSchema = new FileStream(Path.GetFullPath("Output/Excel-Workbook-To-JSON-as-schema.json"), FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAsJson(jsonWithSchema, true);

//Dispose streams
outputStream.Dispose();
stream1.Dispose();
jsonWithSchema.Dispose();
inputStream.Dispose();

#region Open JSON
//Open default JSON

//Open JSON with Schema
#endregion
}
}
}
}





0 comments on commit 8267b36

Please sign in to comment.