@@ -22,15 +22,13 @@ static void ImportArrays(Workbook workbook) {
22
22
workbook . Worksheets [ 0 ] . Cells [ "A1" ] . ColumnWidthInCharacters = 35 ;
23
23
workbook . Worksheets [ 0 ] . Cells [ "A1" ] . Value = "Import an array horizontally:" ;
24
24
workbook . Worksheets [ 0 ] . Cells [ "A3" ] . Value = "Import a two-dimensional array:" ;
25
- //workbook.Worksheets[0].Cells["A6"].Value = "Import data from ArrayList vertically:";
26
- //workbook.Worksheets[0].Cells["A11"].Value = "Import data from a DataTable:";
27
25
28
26
#region #ImportArray
29
27
Worksheet worksheet = workbook . Worksheets [ 0 ] ;
30
28
// Create an array of strings.
31
29
string [ ] array = new string [ ] { "AAA" , "BBB" , "CCC" , "DDD" } ;
32
-
33
- // Import the array into the worksheet and insert it horizontally, starting with the "B1" cell.
30
+ // Insert array values into the worksheet horizontally.
31
+ // Data import starts with the "B1" cell.
34
32
worksheet . Import ( array , 0 , 1 , false ) ;
35
33
#endregion #ImportArray
36
34
@@ -40,8 +38,8 @@ static void ImportArrays(Workbook workbook) {
40
38
{ "Ann" , "Edward" , "Angela" , "Alex" } ,
41
39
{ "Rachel" , "Bruce" , "Barbara" , "George" }
42
40
} ;
43
-
44
- // Import the two-dimensional array into the worksheet and insert it, starting with the "B3" cell.
41
+ // Insert array values into the worksheet.
42
+ // Data import starts with the "B3" cell.
45
43
worksheet . Import ( names , 2 , 1 ) ;
46
44
#endregion #ImportTwoDimensionalArray
47
45
}
@@ -55,8 +53,8 @@ static void ImportList(Workbook workbook) {
55
53
cities . Add ( "Rome" ) ;
56
54
cities . Add ( "Beijing" ) ;
57
55
cities . Add ( "Delhi" ) ;
58
-
59
- // Import the list into the worksheet and insert it vertically, starting with the "B6 " cell.
56
+ // Insert list values into the worksheet vertically.
57
+ // Data import starts with the "A1 " cell.
60
58
worksheet . Import ( cities , 0 , 0 , true ) ;
61
59
#endregion #ImportList
62
60
}
@@ -65,7 +63,7 @@ static void ImportDataTable(Workbook workbook)
65
63
{
66
64
#region #ImportDataTable
67
65
Worksheet worksheet = workbook . Worksheets [ 0 ] ;
68
- // Create a "Employees" DataTable object with four columns.
66
+ // Create an "Employees" DataTable object with four columns.
69
67
DataTable table = new DataTable ( "Employees" ) ;
70
68
table . Columns . Add ( "FirstN" , typeof ( string ) ) ;
71
69
table . Columns . Add ( "LastN" , typeof ( string ) ) ;
@@ -75,7 +73,8 @@ static void ImportDataTable(Workbook workbook)
75
73
table . Rows . Add ( "Nancy" , "Davolio" , "recruiter" , 32 ) ;
76
74
table . Rows . Add ( "Andrew" , "Fuller" , "engineer" , 28 ) ;
77
75
78
- // Import data from the data table into the worksheet and insert it, starting with the "B11" cell.
76
+ // Insert data table values into the worksheet.
77
+ // Data import starts with the "A1" cell.
79
78
worksheet . Import ( table , true , 0 , 0 ) ;
80
79
81
80
// Color the table header.
0 commit comments