Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android Apache poi异常_Java_Android_Apache Poi - Fatal编程技术网

Java Android Apache poi异常

Java Android Apache poi异常,java,android,apache-poi,Java,Android,Apache Poi,我在Android应用程序中使用ApachePOI,但我有一个问题 我想指向一个空单元格,但我有一个空指针异常: Cell cellTest = rowTest.getCell(0,Row.CREATE_NULL_AS_BLANK); 我不理解这个异常我认为您的行不存在变量为空。我想是因为你现在的工作表已经写完了 您可以使用以下方法进行测试: /** * This method return a boolean which represent if the line is after th

我在Android应用程序中使用ApachePOI,但我有一个问题

我想指向一个空单元格,但我有一个空指针异常:

Cell cellTest = rowTest.getCell(0,Row.CREATE_NULL_AS_BLANK);

我不理解这个异常

我认为您的行不存在变量为空。我想是因为你现在的工作表已经写完了

您可以使用以下方法进行测试:

 /**
 * This method return a boolean which represent if the line is after the end of file or    not
 * @param pSheet sheet concerned
 * @param pRow row to verify
 * @return true if the line number is the last or after the last of the file
 */
public static boolean isEndOfSheet(Sheet pSheet, int pRow)
{
    return (pSheet.getLastRowNum() < pRow);
}

对于新文件,您需要创建要放入文件中的每一行和单元格。

如何定义行测试?是的,问题是cellRow rowTest=feuille.getRowtest;//test是一个Int变量,如果对rowTest进行null检查会发生什么:if rowTest!=空单元格cellTest=rowTest.getCell0,Row.CREATE\u null\u AS\u BLANK;该行不存在,因此getRow返回null。先打电话给feuille.createRow。
feuille.createRow(rowNumber) // this return the Row created