File tree Expand file tree Collapse file tree 14 files changed +25
-99
lines changed
Above and Below Average/.NET/Above and Below Average/Above and Below Average
Above and Below Standard Deviation/.NET/Above and Below Standard Deviation/Above and Below Standard Deviation
Color Scales/.NET/Color Scales/Color Scales
Conditional Format with R1C1/.NET/Conditional Format with R1C1/Conditional Format with R1C1
Create Conditional Format/.NET/Create Conditional Format/Create Conditional Format
Data Bars/.NET/Data Bars/Data Bars
Icon Sets/.NET/Icon Sets/Icon Sets
Read Conditional Format/.NET/Read Conditional Format/Read Conditional Format
Remove Conditional Format/.NET/Remove Conditional Format
Remove all Conditional Formats/.NET/Remove all Conditional Formats/Remove all Conditional Formats
Remove at Index/.NET/Remove at Index/Remove at Index
Top To Bottom Percent/.NET/Top To Bottom Percent/Top To Bottom Percent
Top to Bottom Rank/.NET/Top to Bottom Rank/Top to Bottom Rank
Unique and Duplicate/.NET/Unique and Duplicate/Unique and Duplicate Expand file tree Collapse file tree 14 files changed +25
-99
lines changed Original file line number Diff line number Diff 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 [ 0 ] ;
1716
1817 //Applying conditional formatting to "M6:M35"
@@ -32,13 +31,8 @@ static void Main(string[] args)
3231
3332 #region Save
3433 //Saving the workbook
35- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/AboveAndBelowAverage.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
36- workbook . SaveAs ( outputStream ) ;
34+ workbook . SaveAs ( Path . GetFullPath ( "Output/AboveAndBelowAverage.xlsx" ) ) ;
3735 #endregion
38-
39- //Dispose streams
40- outputStream . Dispose ( ) ;
41- inputStream . Dispose ( ) ;
4236 }
4337 }
4438 }
Original file line number Diff line number Diff 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 [ 0 ] ;
1716
1817 //Applying conditional formatting to "M6:M35"
@@ -35,13 +34,8 @@ static void Main(string[] args)
3534
3635 #region Save
3736 //Saving the workbook
38- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/AboveAndBelowStandardDeviation.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
39- workbook . SaveAs ( outputStream ) ;
37+ workbook . SaveAs ( Path . GetFullPath ( "Output/AboveAndBelowStandardDeviation.xlsx" ) ) ;
4038 #endregion
41-
42- //Dispose streams
43- outputStream . Dispose ( ) ;
44- inputStream . Dispose ( ) ;
4539 }
4640 }
4741 }
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 //Create color scales for the data in specified range
@@ -36,13 +35,8 @@ static void Main(string[] args)
3635
3736 #region Save
3837 //Saving the workbook
39- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/Output.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
40- workbook . SaveAs ( outputStream ) ;
38+ workbook . SaveAs ( Path . GetFullPath ( "Output/Output.xlsx" ) ) ;
4139 #endregion
42-
43- //Dispose streams
44- outputStream . Dispose ( ) ;
45- inputStream . Dispose ( ) ;
4640 }
4741 }
4842 }
Original file line number Diff line number Diff line change @@ -22,12 +22,8 @@ static void Main(string[] args)
2222
2323 #region Save
2424 //Saving the workbook
25- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ConditionalFormat.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
26- workbook . SaveAs ( outputStream ) ;
25+ workbook . SaveAs ( Path . GetFullPath ( "Output/ConditionalFormat.xlsx" ) ) ;
2726 #endregion
28-
29- //Dispose streams
30- outputStream . Dispose ( ) ;
3127 }
3228 }
3329 }
Original file line number Diff line number Diff line change @@ -62,12 +62,8 @@ static void Main(string[] args)
6262
6363 #region Save
6464 //Saving the workbook
65- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ConditionalFormat.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
66- workbook . SaveAs ( outputStream ) ;
65+ workbook . SaveAs ( Path . GetFullPath ( "Output/ConditionalFormat.xlsx" ) ) ;
6766 #endregion
68-
69- //Dispose streams
70- outputStream . Dispose ( ) ;
7167 }
7268 }
7369 }
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 //Create data bars for the data in specified range
@@ -30,13 +29,8 @@ static void Main(string[] args)
3029
3130 #region Save
3231 //Saving the workbook
33- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/Output.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
34- workbook . SaveAs ( outputStream ) ;
32+ workbook . SaveAs ( Path . GetFullPath ( "Output/Output.xlsx" ) ) ;
3533 #endregion
36-
37- //Dispose streams
38- outputStream . Dispose ( ) ;
39- inputStream . Dispose ( ) ;
4034 }
4135 }
4236 }
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 //Create icon sets for the data in specified range
@@ -32,13 +31,8 @@ static void Main(string[] args)
3231
3332 #region Save
3433 //Saving the workbook
35- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/Output.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
36- workbook . SaveAs ( outputStream ) ;
34+ workbook . SaveAs ( Path . GetFullPath ( "Output/Output.xlsx" ) ) ;
3735 #endregion
38-
39- //Dispose streams
40- outputStream . Dispose ( ) ;
41- inputStream . Dispose ( ) ;
4236 }
4337 }
4438 }
Original file line number Diff line number Diff line change @@ -11,16 +11,14 @@ 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 , ExcelOpenType . Automatic ) ;
14+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , ExcelOpenType . Automatic ) ;
1615 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1716
1817 //Read conditional formatting settings
1918 string formatType = worksheet . Range [ "A1" ] . ConditionalFormats [ 0 ] . FormatType . ToString ( ) ;
2019 string cfOperator = worksheet . Range [ "A1" ] . ConditionalFormats [ 0 ] . Operator . ToString ( ) ;
2120
22- //Dispose streams
23- inputStream . Dispose ( ) ;
21+ workbook . SaveAs ( "Output.xlsx" ) ;
2422 }
2523 }
2624 }
Original file line number Diff line number Diff line change @@ -12,22 +12,16 @@ static void Main(string[] args)
1212 IApplication application = excelEngine . Excel ;
1313 application . DefaultVersion = ExcelVersion . Xlsx ;
1414
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 //Removing conditional format for a specified range
2019 worksheet . Range [ "E5" ] . ConditionalFormats . Remove ( ) ;
2120
2221 #region Save
2322 //Saving the workbook
24- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/RemoveConditionalFormat.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
25- workbook . SaveAs ( outputStream ) ;
23+ workbook . SaveAs ( Path . GetFullPath ( "Output/RemoveConditionalFormat.xlsx" ) ) ;
2624 #endregion
27-
28- //Dispose streams
29- outputStream . Dispose ( ) ;
30- inputStream . Dispose ( ) ;
3125 }
3226 }
3327 }
Original file line number Diff line number Diff line change @@ -11,22 +11,16 @@ 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 , ExcelOpenType . Automatic ) ;
14+ IWorkbook workbook = application . Workbooks . Open ( Path . GetFullPath ( @"Data/InputTemplate.xlsx" ) , ExcelOpenType . Automatic ) ;
1615 IWorksheet worksheet = workbook . Worksheets [ 0 ] ;
1716
1817 //Removing Conditional Formatting Settings From Entire Sheet
1918 worksheet . UsedRange . Clear ( ExcelClearOptions . ClearConditionalFormats ) ;
2019
2120 #region Save
2221 //Saving the workbook
23- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/RemoveAll.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
24- workbook . SaveAs ( outputStream ) ;
22+ workbook . SaveAs ( Path . GetFullPath ( "Output/RemoveAll.xlsx" ) ) ;
2523 #endregion
26-
27- //Dispose streams
28- outputStream . Dispose ( ) ;
29- inputStream . Dispose ( ) ;
3024 }
3125 }
3226 }
You can’t perform that action at this time.
0 commit comments