File tree Expand file tree Collapse file tree 7 files changed +14
-55
lines changed
Conditional Formatting/.NET/Conditional Formatting/Conditional Formatting
Import Array/.NET/Import Array/Import Array
Import Collection/.NET/Import Collection/Import Collection
Import Data Table/.NET/Import Data Table/Import Data Table
Import Nested Collection/.NET/Import Nested Collection/Import Nested Collection
Import with Hyperlinks/.NET/Import with Hyperlinks/Import with Hyperlinks
Set Template Marker/.NET/Set Template Marker/Set Template Marker Expand file tree Collapse file tree 7 files changed +14
-55
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,7 @@ static void Main(string[] args)
1414 {
1515 IApplication application = excelEngine . Excel ;
1616 application . DefaultVersion = ExcelVersion . Xlsx ;
17- FileStream inputStream = new FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , FileMode . Open , FileAccess . Read ) ;
18- IWorkbook workbook = application . Workbooks . Open ( inputStream , ExcelOpenType . Automatic ) ;
17+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , ExcelOpenType . Automatic ) ;
1918 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
2019
2120 //Create Template Marker Processor
@@ -121,13 +120,8 @@ static void Main(string[] args)
121120
122121 #region Save
123122 //Saving the workbook
124- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ConditionalFormatting.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
125- workbook . SaveAs ( outputStream ) ;
123+ workbook . SaveAs ( Path . GetFullPath ( "Output/ConditionalFormatting.xlsx" ) ) ;
126124 #endregion
127-
128- //Dispose streams
129- outputStream . Dispose ( ) ;
130- inputStream . Dispose ( ) ;
131125 }
132126 }
133127 public static IList < Sales > GetSalesReports ( )
Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ public static void Main(string[] args)
1313 application . DefaultVersion = ExcelVersion . Xlsx ;
1414
1515 // Open an existing workbook.
16- FileStream inputStream = new FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , FileMode . Open , FileAccess . Read ) ;
17- IWorkbook workbook = application . Workbooks . Open ( inputStream , ExcelOpenType . Automatic ) ;
16+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , ExcelOpenType . Automatic ) ;
1817
1918 // Create Template Marker Processor.
2019 ITemplateMarkersProcessor marker = workbook . CreateTemplateMarkersProcessor ( ) ;
@@ -31,12 +30,8 @@ public static void Main(string[] args)
3130 marker . ApplyMarkers ( ) ;
3231
3332 // Saving the workbook.
34- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportArray.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
35- workbook . SaveAs ( outputStream ) ;
33+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportArray.xlsx" ) ) ;
3634
37- //Dispose streams
38- inputStream . Dispose ( ) ;
39- outputStream . Dispose ( ) ;
4035 }
4136 }
4237 }
Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ public static void Main(string[] args)
1313 application . DefaultVersion = ExcelVersion . Xlsx ;
1414
1515 // Open an existing workbook.
16- FileStream inputStream = new FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , FileMode . Open , FileAccess . Read ) ;
17- IWorkbook workbook = application . Workbooks . Open ( inputStream ) ;
16+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ;
1817
1918 // Create Template Marker Processor.
2019 ITemplateMarkersProcessor marker = workbook . CreateTemplateMarkersProcessor ( ) ;
@@ -29,12 +28,7 @@ public static void Main(string[] args)
2928 marker . ApplyMarkers ( ) ;
3029
3130 // Saving the workbook.
32- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportCollection.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
33- workbook . SaveAs ( outputStream ) ;
34-
35- //Dispose streams
36- inputStream . Dispose ( ) ;
37- outputStream . Dispose ( ) ;
31+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportCollection.xlsx" ) ) ;
3832 }
3933 // Gets a list of sales reports.
4034 private static List < Report > GetSalesReports ( )
Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ static void Main(string[] args)
1313 {
1414 IApplication application = excelEngine . Excel ;
1515 application . DefaultVersion = ExcelVersion . Xlsx ;
16- FileStream inputStream = new FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , FileMode . Open , FileAccess . Read ) ;
17- IWorkbook workbook = application . Workbooks . Open ( inputStream , ExcelOpenType . Automatic ) ;
16+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , ExcelOpenType . Automatic ) ;
1817 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1918
2019 //Create Template Marker Processor
@@ -42,13 +41,8 @@ static void Main(string[] args)
4241
4342 #region Save
4443 //Saving the workbook
45- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportDataTable.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
46- workbook . SaveAs ( outputStream ) ;
44+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportDataTable.xlsx" ) ) ;
4745 #endregion
48-
49- //Dispose streams
50- outputStream . Dispose ( ) ;
51- inputStream . Dispose ( ) ;
5246 }
5347 }
5448 }
Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ static void Main(string[] args)
1313 {
1414 IApplication application = excelEngine . Excel ;
1515 application . DefaultVersion = ExcelVersion . Xlsx ;
16- FileStream inputStream = new FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , FileMode . Open , FileAccess . Read ) ;
17- IWorkbook workbook = application . Workbooks . Open ( inputStream , ExcelOpenType . Automatic ) ;
16+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , ExcelOpenType . Automatic ) ;
1817 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1918
2019 //Create Template Marker Processor
@@ -28,13 +27,8 @@ static void Main(string[] args)
2827
2928 #region Save
3029 //Saving the workbook
31- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportNestedCollection.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
32- workbook . SaveAs ( outputStream ) ;
30+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportNestedCollection.xlsx" ) ) ;
3331 #endregion
34-
35- //Dispose streams
36- outputStream . Dispose ( ) ;
37- inputStream . Dispose ( ) ;
3832 }
3933 }
4034 //Get sales Report class
Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ static void Main(string[] args)
1313 {
1414 IApplication application = excelEngine . Excel ;
1515 application . DefaultVersion = ExcelVersion . Xlsx ;
16- FileStream inputStream = new FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , FileMode . Open , FileAccess . Read ) ;
17- IWorkbook workbook = application . Workbooks . Open ( inputStream , ExcelOpenType . Automatic ) ;
16+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , ExcelOpenType . Automatic ) ;
1817 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1918
2019 //Create Template Marker Processor
@@ -28,13 +27,8 @@ static void Main(string[] args)
2827
2928 #region Save
3029 //Saving the workbook
31- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/HyperlinkWithMarker.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
32- workbook . SaveAs ( outputStream ) ;
30+ workbook . SaveAs ( Path . GetFullPath ( "Output/HyperlinkWithMarker.xlsx" ) ) ;
3331 #endregion
34-
35- //Dispose streams
36- outputStream . Dispose ( ) ;
37- inputStream . Dispose ( ) ;
3832 }
3933 }
4034 //Gets a list of company details
Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ static void Main(string[] args)
1212 {
1313 IApplication application = excelEngine . Excel ;
1414 application . DefaultVersion = ExcelVersion . Xlsx ;
15- FileStream inputStream = new FileStream ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , FileMode . Open , FileAccess . Read ) ;
16- IWorkbook workbook = application . Workbooks . Open ( inputStream , ExcelOpenType . Automatic ) ;
15+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , ExcelOpenType . Automatic ) ;
1716 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1817
1918 //Insert Simple marker
@@ -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/TemplateMarker.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
38- workbook . SaveAs ( outputStream ) ;
36+ workbook . SaveAs ( Path . GetFullPath ( "Output/TemplateMarker.xlsx" ) ) ;
3937 #endregion
40-
41- //Dispose streams
42- outputStream . Dispose ( ) ;
43- inputStream . Dispose ( ) ;
4438 }
4539 }
4640 }
You can’t perform that action at this time.
0 commit comments