File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed
Document-Processing/Excel/Conversions/Chart-to-Image Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments