Java Android Apache poi异常
我在Android应用程序中使用ApachePOI,但我有一个问题 我想指向一个空单元格,但我有一个空指针异常: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
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