获取excel文件中非空的行和列

时间:2013-12-02 07:37:42

标签: c# excel datagridview

您可以帮我在excel中获取非空的行和列。我正在做一个项目,它在excel中获取数据并在datagridview中显示它,但它也获得null或空的行和列。

1 个答案:

答案 0 :(得分:1)

在将值添加到String.IsNullOrEmpty()之前使用DataGridView函数。

试试这个:

string str="/*assign cell value from excel*/";
if(!String.IsNullOrEmpty(str))
{

//now Add the cell value to DataGridView as cell is not empty

}

注意:如果您可以使用代码编辑问题,则很容易解决问题。

相关问题