I’m simply trying to read in a spreadsheet, and build a list of objects from the values in the cells.
Two of the cells have formulas applied, how can I read the calculated value instead of the formula.
I’m using Infragistics2.Excel.v8.2, I have seen an example using GetText() from the Infragistics2.Documents.Excel namespace, but I do not seem to have that available, is there another way, if not where can I download the additional dll?
Here is my code, origincountry and destinationcountry are using a formula.
foreach (var row in worksheet.Rows)
{
var fullScheduleUtc = new FullScheduleUtc
{
Title = "",
Carrier = row.Cells[0].Value.ToString(),
FlightNumber = row.Cells[1].Value.ToString(),
DepartureStation = row.Cells[2].Value.ToString(),
OriginCountry = row.Cells[3].Value.ToString(),
DepartureTime = new TimeSpan(),
DestinationStation = row.Cells[5].Value.ToString(),
DestinationCountry = row.Cells[6].Value.ToString(),
ArrivalTime = new TimeSpan(),
EffectivePeriod = row.Cells[8].Value.ToString(),
Monday = true,
Tuesday = false,
Wednesday = true,
Thursday = true,
Friday = true,
Saturday = true,
AircraftType = row.Cells[10].Value.ToString()
};
fullScheduleList.Add(fullScheduleUtc);
}
NetAdvantage 2008 Volume 3 changed the behavior so that GetValue will return the value rather than the formula so you would need to upgrade to NetAdvantage 2008 Volume 3 or later.