如何使用NPOI从Excel文件中的单元格读取所选下拉列表值?

我有一个Excel文件(xls),其中包含一系列下拉列表在F列在第一张表。 每个下拉列表包含7个以上的选项,都是string。 每一行都有一个不同的值。 下面是下拉列表最初是如何使用Microsoft.Office.Interop创build的:

Application xlApp = new ApplicationClass(); Workbook xlWorkBook = null; Worksheet xlWorkSheet = null; object misValue = System.Reflection.Missing.Value; xlWorkBook = xlApp.Workbooks.Add(misValue); xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); Microsoft.Office.Interop.Excel.Range dropDownRange = xlWorkSheet.get_Range("F" + index, misValue); Microsoft.Office.Interop.Excel.DropDowns dropDowns = (Microsoft.Office.Interop.Excel.DropDowns)xlWorkSheet.DropDowns(misValue); Microsoft.Office.Interop.Excel.DropDown dropDown = dropDowns.Add((double)dropDownRange.Left, (double)dropDownRange.Top, (double)dropDownRange.Width, (double)dropDownRange.Height, true); string[] currency = Config.listofCurrency(); for (int i = 0; i < currency.Length; i++) { dropDown.AddItem(currency[i], i + 1); if (currency[i].ToLower() == defaultCurrency.ToLower()) { dropDown.set_Selected(i + 1, misValue); } } xlWorkSheet.get_Range("F" + index, misValue).set_Value(Microsoft.Office.Interop.Excel.XlRangeValueDataType.xlRangeValueDefault, dropDown); 

现在我正在尝试使用NPOI读取文件,以从同一个文件中获取列F中单元格的值。 这是我正在使用的代码:

 using (FileStream fileStream = new FileStream("excel.xls", FileMode.Open, FileAccess.Read)) { HSSFWorkbook hSSFWorkbook = new HSSFWorkbook(fileStream); ISheet isheet = hSSFWorkbook.GetSheetAt(0); IRow currentRow; for (int rowNumber = 1; rowNumber <= isheet.LastRowNum; rowNumber++) { currentRow = isheet.GetRow(rowNumber); ICell cell = currentRow.GetCell(5); Console.WriteLine(currentRow.GetCell(5).ToString()); } } 

但不是string值,我发现单元格types都是数字,并且都设置为值7 ,这与下拉列表中选定的值无关。

我怎样才能得到NPOI中细胞的正确值?

testing使用EPPLus和ClosedXML,都给我7s。