-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorkbook.cs
More file actions
171 lines (143 loc) · 4.69 KB
/
Workbook.cs
File metadata and controls
171 lines (143 loc) · 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#region using statements
using System;
using System.Collections.Generic;
using DataJuggler.UltimateHelper;
#endregion
namespace DataJuggler.Excelerate
{
#region class Workbook
/// <summary>
/// This class represents an Excel Workbook.
/// </summary>
public class Workbook
{
#region Private Variables
private List<Worksheet> worksheets;
private string response;
private List<Exception> errors;
#endregion
#region Constructor
/// <summary>
/// Create a new instance of a Workbook object.
/// </summary>
public Workbook()
{
// Create a new collection of 'Worksheet' objects.
Worksheets = new List<Worksheet>();
}
#endregion
#region Methods
#region GetWorksheetIndex(string worksheetName)
/// <summary>
/// This method returns the Worksheet Index
/// </summary>
public int GetWorksheetIndex(string worksheetName)
{
// initial value
int worksheetIndex = -1;
// local
int index = -1;
// if the value for HasWorksheets is true
if (HasWorksheets)
{
// Iterate the collection of Worksheet objects
foreach (Worksheet worksheet in worksheets)
{
// Increment the value for index
index++;
// if this is the sheet intended
if (TextHelper.IsEqual(worksheet.Name, worksheetName))
{
// set the return value
worksheetIndex = index;
// break out of loop
break;
}
}
}
// return value
return worksheetIndex;
}
#endregion
#endregion
#region Properties
#region Errors
/// <summary>
/// This property gets or sets the value for 'Errors'.
/// </summary>
public List<Exception> Errors
{
get { return errors; }
set { errors = value; }
}
#endregion
#region HasErrors
/// <summary>
/// This property returns true if this object has an 'Errors'.
/// </summary>
public bool HasErrors
{
get
{
// initial value
bool hasErrors = (this.Errors != null);
// return value
return hasErrors;
}
}
#endregion
#region HasResponse
/// <summary>
/// This property returns true if the 'Response' exists.
/// </summary>
public bool HasResponse
{
get
{
// initial value
bool hasResponse = (!String.IsNullOrEmpty(this.Response));
// return value
return hasResponse;
}
}
#endregion
#region HasWorksheets
/// <summary>
/// This property returns true if this object has a 'Worksheets'.
/// </summary>
public bool HasWorksheets
{
get
{
// initial value
bool hasWorksheets = (this.Worksheets != null);
// return value
return hasWorksheets;
}
}
#endregion
#region Response
/// <summary>
/// This property gets or sets the value for 'Response'.
/// </summary>
public string Response
{
get { return response; }
set { response = value; }
}
#endregion
#region Worksheets
/// <summary>
/// This property gets or sets the value for 'Worksheets'.
/// </summary>
public List<Worksheet> Worksheets
{
get { return worksheets; }
set { worksheets = value; }
}
#endregion
#endregion
}
#endregion
}