@@ -446,8 +446,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
446446 IVbaModules vbaModules = project.Modules;
447447
448448 //Opening form module existing workbook
449- FileStream input = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xls"), FileMode.Open, FileAccess.ReadWrite);
450- IWorkbook newBook = application.Workbooks.Open(input);
449+ IWorkbook newBook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xls"));
451450
452451 IVbaProject newProject = newBook.VbaProject;
453452
@@ -470,7 +469,6 @@ using (ExcelEngine excelEngine = new ExcelEngine())
470469 #endregion
471470
472471 //Dispose streams
473- input.Dispose();
474472 outputStream.Dispose();
475473}
476474{% endhighlight %}
@@ -779,8 +777,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
779777{
780778 IApplication application = excelEngine.Excel;
781779 application.DefaultVersion = ExcelVersion.Xlsx;
782- FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xls"), FileMode.Open, FileAccess.Read);
783- IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
780+ IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xls"), ExcelOpenType.Automatic);
784781 IWorksheet sheet = workbook.Worksheets[ 0] ;
785782
786783 //Accessing Vba project
@@ -804,7 +801,6 @@ using (ExcelEngine excelEngine = new ExcelEngine())
804801 #endregion
805802
806803 //Dispose streams
807- inputStream.Dispose();
808804 outputStream.Dispose();
809805}
810806{% endhighlight %}
@@ -900,8 +896,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
900896{
901897 IApplication application = excelEngine.Excel;
902898 application.DefaultVersion = ExcelVersion.Xlsx;
903- FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xls"), FileMode.Open, FileAccess.Read);
904- IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
899+ IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xls"), ExcelOpenType.Automatic);
905900 IWorksheet sheet = workbook.Worksheets[ 0] ;
906901
907902 //Accessing Vba project
@@ -920,7 +915,6 @@ using (ExcelEngine excelEngine = new ExcelEngine())
920915 #endregion
921916
922917 //Dispose streams
923- inputStream.Dispose();
924918 outputStream.Dispose();
925919}
926920{% endhighlight %}
@@ -988,8 +982,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
988982{
989983 IApplication application = excelEngine.Excel;
990984 application.DefaultVersion = ExcelVersion.Xlsx;
991- FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xls"), FileMode.Open, FileAccess.Read);
992- IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
985+ IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xls"), ExcelOpenType.Automatic);
993986 IWorksheet sheet = workbook.Worksheets[ 0] ;
994987
995988 //Accessing Vba project
@@ -1008,7 +1001,6 @@ using (ExcelEngine excelEngine = new ExcelEngine())
10081001 #endregion
10091002
10101003 //Dispose streams
1011- inputStream.Dispose();
10121004 outputStream.Dispose();
10131005}
10141006{% endhighlight %}
@@ -1074,8 +1066,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
10741066{
10751067 IApplication application = excelEngine.Excel;
10761068 application.DefaultVersion = ExcelVersion.Xlsx;
1077- FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xls"), FileMode.Open, FileAccess.Read);
1078- IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
1069+ IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xls"), ExcelOpenType.Automatic);
10791070 IWorksheet sheet = workbook.Worksheets[ 0] ;
10801071
10811072 //Accessing Vba project
@@ -1094,7 +1085,6 @@ using (ExcelEngine excelEngine = new ExcelEngine())
10941085 #endregion
10951086
10961087 //Dispose streams
1097- inputStream.Dispose();
10981088 outputStream.Dispose();
10991089}
11001090{% endhighlight %}
@@ -1161,8 +1151,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
11611151{
11621152 IApplication application = excelEngine.Excel;
11631153 application.DefaultVersion = ExcelVersion.Xlsx;
1164- FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xls"), FileMode.Open, FileAccess.Read);
1165- IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
1154+ IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xls"), ExcelOpenType.Automatic);
11661155 IWorksheet sheet = workbook.Worksheets[ 0] ;
11671156
11681157 //Skip Macros while saving
@@ -1175,7 +1164,6 @@ using (ExcelEngine excelEngine = new ExcelEngine())
11751164 #endregion
11761165
11771166 //Dispose streams
1178- inputStream.Dispose();
11791167 outputStream.Dispose();
11801168}
11811169{% endhighlight %}
0 commit comments