Skip to content

Commit cb3eaae

Browse files
Merge branch 'hotfix/hotfix-v31.2.2' into 259599-ug
2 parents 7ececdb + 6b74c3b commit cb3eaae

File tree

12 files changed

+82
-230
lines changed

12 files changed

+82
-230
lines changed

Document-Processing/Excel/Conversions/CSV-to-Excel/NET/CSV-to-Excel-Conversion.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,13 @@ using (ExcelEngine excelEngine = new ExcelEngine())
2727
{
2828
IApplication application = excelEngine.Excel;
2929
application.DefaultVersion = ExcelVersion.Xlsx;
30-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.csv"), FileMode.Open, FileAccess.Read);
3130

3231
//Open the CSV file
33-
IWorkbook workbook = application.Workbooks.Open(inputStream, ",");
32+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.csv"), ",");
3433
IWorksheet worksheet = workbook.Worksheets[0];
3534

36-
//Saving the workbook as stream
37-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.xlsx"), FileMode.Create, FileAccess.Write);
38-
workbook.SaveAs(outputStream);
39-
40-
//Dispose streams
41-
outputStream.Dispose();
42-
inputStream.Dispose();
35+
//Saving the workbook
36+
workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx"));
4337
}
4438
{% endhighlight %}
4539

@@ -85,16 +79,10 @@ using (ExcelEngine excelEngine = new ExcelEngine())
8579
application.DefaultVersion = ExcelVersion.Xlsx;
8680

8781
//Open the TSV file
88-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.tsv"), FileMode.Open, FileAccess.Read);
89-
IWorkbook workbook = application.Workbooks.Open(inputStream, "\t");
82+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.tsv"), "\t");
9083

9184
//Save the workbook
92-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.xlsx"), FileMode.Create, FileAccess.ReadWrite);
93-
workbook.SaveAs(outputStream);
94-
95-
//Dispose streams
96-
outputStream.Dispose();
97-
inputStream.Dispose();
85+
workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx"));
9886
}
9987
{% endhighlight %}
10088

Document-Processing/Excel/Conversions/CSV-to-Excel/overview.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,13 @@ using (ExcelEngine excelEngine = new ExcelEngine())
2727
{
2828
IApplication application = excelEngine.Excel;
2929
application.DefaultVersion = ExcelVersion.Xlsx;
30-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.csv"), FileMode.Open, FileAccess.Read);
3130

3231
//Open the CSV file
33-
IWorkbook workbook = application.Workbooks.Open(inputStream, ",");
32+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.csv"), ",");
3433
IWorksheet worksheet = workbook.Worksheets[0];
3534

36-
//Saving the workbook as stream
37-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.xlsx"), FileMode.Create, FileAccess.Write);
38-
workbook.SaveAs(outputStream);
39-
40-
//Dispose streams
41-
outputStream.Dispose();
42-
inputStream.Dispose();
35+
//Saving the workbook
36+
workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx"));
4337
}
4438
{% endhighlight %}
4539

@@ -85,16 +79,10 @@ using (ExcelEngine excelEngine = new ExcelEngine())
8579
application.DefaultVersion = ExcelVersion.Xlsx;
8680

8781
//Open the TSV file
88-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.tsv"), FileMode.Open, FileAccess.Read);
89-
IWorkbook workbook = application.Workbooks.Open(inputStream, "\t");
82+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.tsv"), "\t");
9083

9184
//Save the workbook
92-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.xlsx"), FileMode.Create, FileAccess.ReadWrite);
93-
workbook.SaveAs(outputStream);
94-
95-
//Dispose streams
96-
outputStream.Dispose();
97-
inputStream.Dispose();
85+
workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx"));
9886
}
9987
{% endhighlight %}
10088

Document-Processing/Excel/Conversions/Chart-to-Image/NET/Chart-to-Image-Conversion.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
3535
application.XlsIORenderer.ChartRenderingOptions.ScalingMode = ScalingMode.Best;
3636

3737
//Open existing workbook with chart
38-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
39-
IWorkbook workbook = application.Workbooks.Open(inputStream);
38+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
4039
IWorksheet worksheet = workbook.Worksheets[0];
4140

4241
//Access the chart from the worksheet
@@ -50,7 +49,6 @@ using (ExcelEngine excelEngine = new ExcelEngine())
5049

5150
//Dispose streams
5251
outputStream.Dispose();
53-
inputStream.Dispose();
5452
}
5553
{% endhighlight %}
5654

Document-Processing/Excel/Conversions/Chart-to-Image/overview.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
2828
//Set converter chart image format to PNG
2929
application.XlsIORenderer.ChartRenderingOptions.ImageFormat = ExportImageFormat.Png;
3030

31-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
32-
IWorkbook workbook = application.Workbooks.Open(inputStream);
31+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
3332
IWorksheet worksheet = workbook.Worksheets[0];
3433

3534
IChart chart = worksheet.Charts[0];
@@ -42,7 +41,6 @@ using (ExcelEngine excelEngine = new ExcelEngine())
4241

4342
//Dispose streams
4443
outputStream.Dispose();
45-
inputStream.Dispose();
4644
}
4745
{% endhighlight %}
4846

Document-Processing/Excel/Conversions/Excel-to-CSV/NET/Excel-to-CSV-Conversion.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,10 @@ using (ExcelEngine excelEngine = new ExcelEngine())
2727
{
2828
IApplication application = excelEngine.Excel;
2929
application.DefaultVersion = ExcelVersion.Xlsx;
30-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
31-
IWorkbook workbook = application.Workbooks.Open(inputStream);
30+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
3231

33-
//Saving the workbook as streams
34-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Sample.csv"), FileMode.Create, FileAccess.ReadWrite);
35-
workbook.SaveAs(outputStream, ",");
36-
37-
//Dispose streams
38-
outputStream.Dispose();
39-
inputStream.Dispose();
32+
//Saving the workbook
33+
workbook.SaveAs(Path.GetFullPath("Output/Sample.csv"), ",");
4034
}
4135
{% endhighlight %}
4236

@@ -83,16 +77,14 @@ using (ExcelEngine excelEngine = new ExcelEngine())
8377
application.MaximumRowsForCsv = 3000000;
8478
application.MaximumColumnsForCsv = 20000;
8579

86-
FileStream inputStream = new FileStream("Sample.csv", FileMode.Open, FileAccess.Read);
87-
IWorkbook workbook = application.Workbooks.Open(inputStream);
80+
IWorkbook workbook = application.Workbooks.Open("Sample.csv");
8881
IWorksheet sheet = workbook.Worksheets[0];
8982

9083
sheet.Range[2000000, 1].Text = "Syncfusion";
9184
sheet.Range[20, 18000].Text = "Syncfusion";
9285

93-
//Saving the workbook as stream
94-
FileStream outputStream = new FileStream("Output.csv", FileMode.Create, FileAccess.ReadWrite);
95-
workbook.SaveAs(outputStream,",");
86+
//Saving the workbook
87+
workbook.SaveAs("Output.csv",",");
9688
}
9789
{% endhighlight %}
9890

@@ -149,12 +141,10 @@ using (ExcelEngine excelEngine = new ExcelEngine())
149141
IApplication application = excelEngine.Excel;
150142
application.DefaultVersion = ExcelVersion.Xlsx;
151143

152-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
153-
IWorkbook workbook = application.Workbooks.Open(inputStream);
144+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
154145

155146
//Save the workbook in CSV format with tab(\t) as delimiter
156-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.tsv"), FileMode.Create, FileAccess.ReadWrite);
157-
workbook.SaveAs(outputStream, "\t");
147+
workbook.SaveAs(Path.GetFullPath("Output/Output.tsv"), "\t");
158148
}
159149
{% endhighlight %}
160150

Document-Processing/Excel/Conversions/Excel-to-CSV/overview.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,10 @@ using (ExcelEngine excelEngine = new ExcelEngine())
2727
{
2828
IApplication application = excelEngine.Excel;
2929
application.DefaultVersion = ExcelVersion.Xlsx;
30-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
31-
IWorkbook workbook = application.Workbooks.Open(inputStream);
30+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
3231

33-
//Saving the workbook as streams
34-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Sample.csv"), FileMode.Create, FileAccess.ReadWrite);
35-
workbook.SaveAs(outputStream, ",");
36-
37-
//Dispose streams
38-
outputStream.Dispose();
39-
inputStream.Dispose();
32+
//Saving the workbook
33+
workbook.SaveAs(Path.GetFullPath("Output/Sample.csv"), ",");
4034
}
4135
{% endhighlight %}
4236

@@ -83,16 +77,14 @@ using (ExcelEngine excelEngine = new ExcelEngine())
8377
application.MaximumRowsForCsv = 3000000;
8478
application.MaximumColumnsForCsv = 20000;
8579

86-
FileStream inputStream = new FileStream("Sample.csv", FileMode.Open, FileAccess.Read);
87-
IWorkbook workbook = application.Workbooks.Open(inputStream);
80+
IWorkbook workbook = application.Workbooks.Open("Sample.csv");
8881
IWorksheet sheet = workbook.Worksheets[0];
8982

9083
sheet.Range[2000000, 1].Text = "Syncfusion";
9184
sheet.Range[20, 18000].Text = "Syncfusion";
9285

93-
//Saving the workbook as stream
94-
FileStream outputStream = new FileStream("Output.csv", FileMode.Create, FileAccess.ReadWrite);
95-
workbook.SaveAs(outputStream,",");
86+
//Saving the workbook
87+
workbook.SaveAs("Output.csv",",");
9688
}
9789
{% endhighlight %}
9890

@@ -149,12 +141,10 @@ using (ExcelEngine excelEngine = new ExcelEngine())
149141
IApplication application = excelEngine.Excel;
150142
application.DefaultVersion = ExcelVersion.Xlsx;
151143

152-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
153-
IWorkbook workbook = application.Workbooks.Open(inputStream);
144+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
154145

155146
//Save the workbook in CSV format with tab(\t) as delimiter
156-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.tsv"), FileMode.Create, FileAccess.ReadWrite);
157-
workbook.SaveAs(outputStream, "\t");
147+
workbook.SaveAs(Path.GetFullPath("Output/Output.tsv"), "\t");
158148
}
159149
{% endhighlight %}
160150

Document-Processing/Excel/Conversions/Excel-to-HTML/NET/Excel-to-HTML-Conversion.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
3535
worksheet.SaveAsHtml(stream);
3636

3737
//Save a workbook as HTML file
38-
workbook.SaveAsHtml(stream, Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default);
38+
workbook.SaveAsHtml("Sample.html", Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default);
3939
stream.Dispose();
4040
workbook.Close();
4141
}
@@ -97,12 +97,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
9797

9898
#region Save as HTML
9999
//Saving the workbook
100-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.html"), FileMode.Create, FileAccess.Write);
101-
workbook.SaveAsHtml(outputStream, saveOptions);
100+
workbook.SaveAsHtml(Path.GetFullPath("Output/Output.html"), saveOptions);
102101
#endregion
103-
104-
//Dispose streams
105-
outputStream.Dispose();
106102
}
107103
{% endhighlight %}
108104

Document-Processing/Excel/Conversions/Excel-to-HTML/overview.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
3535
worksheet.SaveAsHtml(stream);
3636

3737
//Save a workbook as HTML file
38-
workbook.SaveAsHtml(stream, Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default);
38+
workbook.SaveAsHtml("Sample.html", Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default);
3939
stream.Dispose();
4040
workbook.Close();
4141
}
@@ -97,12 +97,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
9797

9898
#region Save as HTML
9999
//Saving the workbook
100-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.html"), FileMode.Create, FileAccess.Write);
101-
workbook.SaveAsHtml(outputStream, saveOptions);
100+
workbook.SaveAsHtml(Path.GetFullPath("Output/Output.html"), saveOptions);
102101
#endregion
103-
104-
//Dispose streams
105-
outputStream.Dispose();
106102
}
107103
{% endhighlight %}
108104

0 commit comments

Comments
 (0)