我正在使用 Excel 互操作库使用 c#.net 从 Excel 文件中获取值。
现在我面临一个问题,我认为所有值都以通用或文本格式获取。
我使用了下面的代码。
        string fileName = Directory.GetCurrentDirectory() + "\\123.xlsx";
        Excel.Application xlApp;
        Excel.Workbook xlWorkbook;
        xlApp = new Excel.Application();
        xlWorkbook = xlApp.Workbooks.Open(fileName);
        Excel._Worksheet xlWorksheet = (Excel._Worksheet)xlApp.Workbooks[1].Worksheets[1];
        Excel.Range excelCell = xlWorksheet.UsedRange;
        Object[,] values = (Object[,])excelCell.Value;
例子:
       
I am getting '41369' instead of 4/5/2013 from B4 cell and 100 instead of 100.00 from A2 call.