File tree Expand file tree Collapse file tree 7 files changed +13
-53
lines changed
Add Total Row/.NET/Add Total Row/Add Total Row
Apply Custom Style/.NET/Apply Custom Style/Apply Custom Style
Create Table/.NET/Create Table/Create Table
Format Table/.NET/Format Table/Format Table
Insert Column/.NET/Insert Column/Insert Column
Read Table/.NET/Read Table/Read Table
Remove Column/.NET/Remove Column/Remove Column Expand file tree Collapse file tree 7 files changed +13
-53
lines changed 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 ) ;
15+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ;
1716 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1817
1918 //Creating a table
@@ -27,13 +26,8 @@ static void Main(string[] args)
2726
2827 #region Save
2928 //Saving the workbook
30- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/AddTotalRow.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
31- workbook . SaveAs ( outputStream ) ;
29+ workbook . SaveAs ( Path . GetFullPath ( "Output/AddTotalRow.xlsx" ) ) ;
3230 #endregion
33-
34- //Dispose streams
35- inputStream . Dispose ( ) ;
36- outputStream . Dispose ( ) ;
3731 }
3832 }
3933 }
Original file line number Diff line number Diff line change @@ -100,12 +100,8 @@ static void Main(string[] args)
100100
101101 #region Save
102102 //Saving the workbook
103- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/CustomTableStyle.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
104- workbook . SaveAs ( outputStream ) ;
103+ workbook . SaveAs ( Path . GetFullPath ( "Output/CustomTableStyle.xlsx" ) ) ;
105104 #endregion
106-
107- //Dispose streams
108- outputStream . Dispose ( ) ;
109105 }
110106 }
111107 }
Original file line number Diff line number Diff line change @@ -12,22 +12,16 @@ 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 ) ;
15+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ;
1716 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1817
1918 //Create for the given data
2019 IListObject table = worksheet . ListObjects . Create ( "Table1" , worksheet [ "A1:C5" ] ) ;
2120
2221 #region Save
2322 //Saving the workbook
24- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/CreateTable.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
25- workbook . SaveAs ( outputStream ) ;
23+ workbook . SaveAs ( Path . GetFullPath ( "Output/CreateTable.xlsx" ) ) ;
2624 #endregion
27-
28- //Dispose streams
29- inputStream . Dispose ( ) ;
30- outputStream . Dispose ( ) ;
3125 }
3226 }
3327 }
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 ) ;
15+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ;
1716 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1817
1918 //Creating a table
@@ -24,13 +23,8 @@ static void Main(string[] args)
2423
2524 #region Save
2625 //Saving the workbook
27- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/FormatTable.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
28- workbook . SaveAs ( outputStream ) ;
26+ workbook . SaveAs ( Path . GetFullPath ( "Output/FormatTable.xlsx" ) ) ;
2927 #endregion
30-
31- //Dispose streams
32- inputStream . Dispose ( ) ;
33- outputStream . Dispose ( ) ;
3428 }
3529 }
3630 }
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 ) ;
15+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ;
1716 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1817
1918 //Creating a table
@@ -24,13 +23,8 @@ static void Main(string[] args)
2423
2524 #region Save
2625 //Saving the workbook
27- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/InsertTableColumn.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
28- workbook . SaveAs ( outputStream ) ;
26+ workbook . SaveAs ( Path . GetFullPath ( "Output/InsertTableColumn.xlsx" ) ) ;
2927 #endregion
30-
31- //Dispose streams
32- inputStream . Dispose ( ) ;
33- outputStream . Dispose ( ) ;
3428 }
3529 }
3630 }
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 ) ;
15+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ;
1716 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1817
1918 //Accessing first table in the sheet
@@ -24,13 +23,8 @@ static void Main(string[] args)
2423
2524 #region Save
2625 //Saving the workbook
27- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ReadTable.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
28- workbook . SaveAs ( outputStream ) ;
26+ workbook . SaveAs ( Path . GetFullPath ( "Output/ReadTable.xlsx" ) ) ;
2927 #endregion
30-
31- //Dispose streams
32- inputStream . Dispose ( ) ;
33- outputStream . Dispose ( ) ;
3428 }
3529 }
3630 }
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 ) ;
15+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) ) ;
1716 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1817
1918 //Creating a table
@@ -24,13 +23,8 @@ static void Main(string[] args)
2423
2524 #region Save
2625 //Saving the workbook
27- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/RemoveTableColumn.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
28- workbook . SaveAs ( outputStream ) ;
26+ workbook . SaveAs ( Path . GetFullPath ( "Output/RemoveTableColumn.xlsx" ) ) ;
2927 #endregion
30-
31- //Dispose streams
32- inputStream . Dispose ( ) ;
33- outputStream . Dispose ( ) ;
3428 }
3529 }
3630 }
You can’t perform that action at this time.
0 commit comments