读书人

未将对象引用设置到对象的实例,关于NP

发布时间: 2012-05-08 22:09:41 作者: rapoo

未将对象引用设置到对象的实例,关于NPOI

C# code
                string dim = convert.isNull(sheet1.GetRow(row).GetCell(2));                if (dim == "1" || dim == "3")                {                    string RKBIT1 = convert.isNull(sheet1.GetRow(row).GetCell(5).ToString().Trim());                    string RKBIT2 = convert.isNull(sheet1.GetRow(row).GetCell(6));                    string data = convert.isNull(sheet1.GetRow(row).GetCell(2).ToString().Trim());                    string fangxiang = convert.isNull(sheet1.GetRow(row).GetCell(3).ToString().Trim());                    string BAKEY = convert.isNull(sheet1.GetRow(row).GetCell(4).ToString().Trim());                    string value = get_per_database(RKBIT1, RKBIT2, STIME, ETIME, data, fangxiang, BAKEY);                    double newvalue = convert.StrTodouble(value);                    if (newvalue != 0)                    {                        //sheet1.GetRow(row).GetCell(9).SetCellValue(newvalue);                        [color=#FF0000]sheet1.GetRow(row).GetCell(9).SetCellValue(1.0);[/color]                    }                }

问题停留在这里,提示未将对象引用设置到对象的实例

[解决办法]
查GetRow(row)返回了null还是GetCell(9)返回了null

读书人网 >C#

热点推荐