C# NPOI:如何读取没有表头的excel单元格
我正在尝试使用NPOI从C# NPOI:如何读取没有表头的excel单元格,c#,excel,parsing,npoi,C#,Excel,Parsing,Npoi,我正在尝试使用NPOI从.xlsxExcel文件中提取文本 下面是示例Excel文件的链接: 函数ExcelDocumentToText提取所有单元格值,但不提取包含INR的单元格(单元格F2) static void ExcelDocumentToText(字符串路径=@.\..\01.xlsx”) { StringBuilder textofExceldCumnet=新的StringBuilder(); ISHET sheet=null;IRow headerRow=null;IEnume
.xlsx
Excel文件中提取文本
下面是示例Excel文件的链接:
函数ExcelDocumentToText
提取所有单元格值,但不提取包含INR的单元格(单元格F2)
static void ExcelDocumentToText(字符串路径=@.\..\01.xlsx”)
{
StringBuilder textofExceldCumnet=新的StringBuilder();
ISHET sheet=null;IRow headerRow=null;IEnumerator allRows=null;
使用(FileStream ExcelFile=newfilestream(路径,FileMode.Open,FileAccess.Read))
xlsReaderObject=新的XSSF工作簿(Excel文件);
对于(int j=0;j
任何人都可以找到这个查询的解决方案吗?ICell根据单元格类型对值有不同的属性。您可以使用类似于以下内容的内容:
switch (cell.CellType)
{
case CellType.Blank:
return string.Empty;
case CellType.Boolean:
return cell.BooleanCellValue;
case CellType.Formula:
return cell.CellFormula;
case CellType.Numeric:
return cell.NumericCellValue;
case CellType.String:
return cell.StringCellValue;
default:
return string.Empty;
}
什么是xlsReaderObject?它是XSSF工作簿的对象。。。
switch (cell.CellType)
{
case CellType.Blank:
return string.Empty;
case CellType.Boolean:
return cell.BooleanCellValue;
case CellType.Formula:
return cell.CellFormula;
case CellType.Numeric:
return cell.NumericCellValue;
case CellType.String:
return cell.StringCellValue;
default:
return string.Empty;
}