Skip to content

Commit 8267b36

Browse files
authored
Update Program.cs
1 parent f18bb80 commit 8267b36

File tree

1 file changed

+4
-22
lines changed
  • Convert Excel to JSON/Workbook to JSON with Schema/.NET/Workbook to JSON with Schema/Workbook to JSON with Schema

1 file changed

+4
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Syncfusion.XlsIO;
1+
using Syncfusion.XlsIO;
22
using System;
33
using System.IO;
44

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

19-
#region save as JSON
20-
//Saves the workbook to a JSON filestream, as schema by default
21-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Excel-Workbook-To-JSON-as-schema-default.json"), FileMode.Create, FileAccess.ReadWrite);
22-
workbook.SaveAsJson(outputStream);
23-
2419
//Saves the workbook to a JSON filestream as schema
25-
FileStream stream1 = new FileStream(Path.GetFullPath("Output/Excel-Workbook-To-JSON-as-schema.json"), FileMode.Create, FileAccess.ReadWrite);
26-
workbook.SaveAsJson(stream1, true);
27-
#endregion
20+
FileStream jsonWithSchema = new FileStream(Path.GetFullPath("Output/Excel-Workbook-To-JSON-as-schema.json"), FileMode.Create, FileAccess.ReadWrite);
21+
workbook.SaveAsJson(jsonWithSchema, true);
2822

2923
//Dispose streams
30-
outputStream.Dispose();
31-
stream1.Dispose();
24+
jsonWithSchema.Dispose();
3225
inputStream.Dispose();
33-
34-
#region Open JSON
35-
//Open default JSON
36-
37-
//Open JSON with Schema
38-
#endregion
3926
}
4027
}
4128
}
4229
}
43-
44-
45-
46-
47-

0 commit comments

Comments
 (0)