Infragistics.Excel 8.2 如何从具有公式的单元格中获取文本值



我只是想在电子表格中读取,并根据单元格中的值构建对象列表。

其中两个单元格应用了公式,如何读取计算值而不是公式。

我正在使用Infragistics2.Excel.v8.2,我已经从Infragistics2.Documents.Excel命名空间看到了一个使用GetText()的示例,但我似乎没有可用的,有没有另一种方法,如果不是,我可以在哪里下载额外的dll?

这是我的代码,原产国和目的地国家都使用公式。

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

更改了行为,以便 GetValue 返回值而不是公式,因此您需要升级到 NetAdvantage 2008 Volume 3 或更高版本。

最新更新