Skip to content

Commit 59e2909

Browse files
988874-Working with Pivot Charts
1 parent 3e1b4ef commit 59e2909

File tree

1 file changed

+2
-8
lines changed
  • Pivot Charts/Create Pivot Chart/.NET/Create Pivot Chart/Create Pivot Chart

1 file changed

+2
-8
lines changed

Pivot Charts/Create Pivot Chart/.NET/Create Pivot Chart/Create Pivot Chart/Program.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ static void Main(string[] args)
1111
{
1212
IApplication application = excelEngine.Excel;
1313
application.DefaultVersion = ExcelVersion.Xlsx;
14-
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
15-
IWorkbook workbook = application.Workbooks.Open(inputStream);
14+
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"));
1615
IWorksheet worksheet = workbook.Worksheets[1];
1716
IPivotTable pivotTable = worksheet.PivotTables[0];
1817

@@ -34,13 +33,8 @@ static void Main(string[] args)
3433

3534
#region Save
3635
//Saving the workbook
37-
FileStream outputStream = new FileStream(Path.GetFullPath("Output/PivotChart.xlsx"), FileMode.Create, FileAccess.Write);
38-
workbook.SaveAs(outputStream);
36+
workbook.SaveAs(Path.GetFullPath("Output/PivotChart.xlsx"));
3937
#endregion
40-
41-
//Dispose streams
42-
outputStream.Dispose();
43-
inputStream.Dispose();
4438
}
4539
}
4640
}

0 commit comments

Comments
 (0)