File tree Expand file tree Collapse file tree 13 files changed +15
-67
lines changed
Array to Worksheet/.NET/Array to Worksheet/Array to Worksheet
CollectionObjects to Worksheet/.NET/CollectionObjects to Worksheet/CollectionObjects to Worksheet
DataColumn to Worksheet/.NET/DataColumn to Worksheet/DataColumn to Worksheet
DataTable to Worksheet/.NET/DataTable to Worksheet/DataTable to Worksheet
DataView to Worksheet/.NET/DataView to Worksheet/DataView to Worksheet
Grouping Options/.NET/Grouping Options/Grouping Options
HTML Table to Worksheet/.NET/HTML Table to Worksheet/HTML Table to Worksheet
Import Data Options/.NET/Import Data Options/Import Data Options
Import with Hyperlink/.NET/Import with Hyperlink/Import with Hyperlink
Layout Options/.NET/Layout Options/Layout Options
Worksheet to CollectionObjects/.NET/Worksheet to CollectionObjects/Worksheet to CollectionObjects
Worksheet to DataTable/.NET/Worksheet to DataTable/Worksheet to DataTable
Worksheet to Nested Class/.NET/Worksheet to Nested Class/Worksheet to Nested Class Expand file tree Collapse file tree 13 files changed +15
-67
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,8 @@ static void Main(string[] args)
2121
2222 #region Save
2323 //Saving the workbook
24- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ArrayToWorksheet.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
25- workbook . SaveAs ( outputStream ) ;
24+ workbook . SaveAs ( Path . GetFullPath ( "Output/ArrayToWorksheet.xlsx" ) ) ;
2625 #endregion
27-
28- //Dispose streams
29- outputStream . Dispose ( ) ;
3026 }
3127 }
3228 }
Original file line number Diff line number Diff line change @@ -24,12 +24,8 @@ static void Main(string[] args)
2424
2525 #region Save
2626 //Saving the workbook
27- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportCollectionObjects.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
28- workbook . SaveAs ( outputStream ) ;
27+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportCollectionObjects.xlsx" ) ) ;
2928 #endregion
30-
31- //Dispose streams
32- outputStream . Dispose ( ) ;
3329 }
3430 }
3531 //Gets a list of sales reports
Original file line number Diff line number Diff line change @@ -26,12 +26,8 @@ static void Main(string[] args)
2626
2727 #region Save
2828 //Saving the workbook
29- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportDataColumn.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
30- workbook . SaveAs ( outputStream ) ;
29+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportDataColumn.xlsx" ) ) ;
3130 #endregion
32-
33- //Dispose streams
34- outputStream . Dispose ( ) ;
3531 }
3632 }
3733 private static DataTable SampleDataTable ( )
Original file line number Diff line number Diff line change @@ -25,12 +25,8 @@ static void Main(string[] args)
2525
2626 #region Save
2727 //Saving the workbook
28- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportDataTable.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
29- workbook . SaveAs ( outputStream ) ;
28+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportDataTable.xlsx" ) ) ;
3029 #endregion
31-
32- //Dispose streams
33- outputStream . Dispose ( ) ;
3430 }
3531 }
3632 private static DataTable SampleDataTable ( )
Original file line number Diff line number Diff line change @@ -26,12 +26,8 @@ static void Main(string[] args)
2626
2727 #region Save
2828 //Saving the workbook
29- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportDataView.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
30- workbook . SaveAs ( outputStream ) ;
29+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportDataView.xlsx" ) ) ;
3130 #endregion
32-
33- //Dispose streams
34- outputStream . Dispose ( ) ;
3531 }
3632 }
3733 private static DataTable SampleDataTable ( )
Original file line number Diff line number Diff line change @@ -52,21 +52,16 @@ private static void ImportData()
5252
5353 #region Save
5454 //Saving the workbook
55- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportData.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
56- workbook . SaveAs ( outputStream ) ;
55+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportData.xlsx" ) ) ;
5756 #endregion
58-
59- //Dispose streams
60- outputStream . Dispose ( ) ;
6157 }
6258 //Helper method to load data from XML file and add them in collections.
6359 private static IList < Brand > GetVehicleDetails ( )
6460 {
6561 XmlSerializer deserializer = new XmlSerializer ( typeof ( BrandObjects ) ) ;
6662
6763 //Read data from XML file.
68- FileStream stream = new FileStream ( Path . GetFullPath ( @"Data/ExportData.xml" ) , FileMode . Open , FileAccess . Read ) ;
69- TextReader textReader = new StreamReader ( stream ) ;
64+ TextReader textReader = new StreamReader ( Path . GetFullPath ( @"Data/ExportData.xml" ) ) ;
7065 BrandObjects brands = ( BrandObjects ) deserializer . Deserialize ( textReader ) ;
7166
7267 //Initialize parent collection to add data from XML file.
Original file line number Diff line number Diff line change @@ -20,12 +20,10 @@ static void Main(string[] args)
2020
2121 #region Save
2222 //Saving the workbook
23- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/HTMLTabletoWorksheet.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
24- workbook . SaveAs ( outputStream ) ;
23+ workbook . SaveAs ( Path . GetFullPath ( "Output/HTMLTabletoWorksheet.xlsx" ) ) ;
2524 #endregion
2625
2726 //Dispose streams
28- outputStream . Dispose ( ) ;
2927 inputStream . Dispose ( ) ;
3028 }
3129 }
Original file line number Diff line number Diff line change @@ -28,12 +28,8 @@ static void Main(string[] args)
2828
2929 #region Save
3030 //Saving the workbook
31- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportDataOptions.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
32- workbook . SaveAs ( outputStream ) ;
31+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportDataOptions.xlsx" ) ) ;
3332 #endregion
34-
35- //Dispose streams
36- outputStream . Dispose ( ) ;
3733 }
3834 }
3935 //Gets a list of sales reports
Original file line number Diff line number Diff line change @@ -21,12 +21,8 @@ static void Main(string[] args)
2121
2222 #region Save
2323 //Saving the workbook
24- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportData.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
25- workbook . SaveAs ( outputStream ) ;
24+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportData.xlsx" ) ) ;
2625 #endregion
27-
28- //Dispose streams
29- outputStream . Dispose ( ) ;
3026 }
3127 }
3228 //Gets a list of company details
Original file line number Diff line number Diff line change @@ -45,21 +45,16 @@ private static void ImportData()
4545
4646 #region Save
4747 //Saving the workbook
48- FileStream outputStream = new FileStream ( Path . GetFullPath ( "Output/ImportData.xlsx" ) , FileMode . Create , FileAccess . Write ) ;
49- workbook . SaveAs ( outputStream ) ;
48+ workbook . SaveAs ( Path . GetFullPath ( "Output/ImportData.xlsx" ) ) ;
5049 #endregion
51-
52- //Dispose streams
53- outputStream . Dispose ( ) ;
5450 }
5551 //Helper method to load data from XML file and add them in collections.
5652 private static IList < Brand > GetVehicleDetails ( )
5753 {
5854 XmlSerializer deserializer = new XmlSerializer ( typeof ( BrandObjects ) ) ;
5955
6056 //Read data from XML file.
61- FileStream stream = new FileStream ( Path . GetFullPath ( @"Data/ExportData.xml" ) , FileMode . Open , FileAccess . Read ) ;
62- TextReader textReader = new StreamReader ( stream ) ;
57+ TextReader textReader = new StreamReader ( Path . GetFullPath ( @"Data/ExportData.xml" ) ) ;
6358 BrandObjects brands = ( BrandObjects ) deserializer . Deserialize ( textReader ) ;
6459
6560 //Initialize parent collection to add data from XML file.
You can’t perform that action at this time.
0 commit comments