Skip to content

Commit f334d33

Browse files
authored
Merge pull request #1725 from syncfusion-content/990137-ChartToImageUG
990137-Modify file streams of C# [Cross-platform] in XlsIO UG
2 parents ebc57cc + 122edac commit f334d33

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

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

0 commit comments

Comments
 (0)