如果Excelthdxgz没有值,row.getCell ()方法将无法获取thdxgz (在本例中为row.createCell ) )方法!
rowrow=sheet.getrow(r; for(intc=0; c=27; c )//thdxgz没有值(等于null )时,使用createCell方法,因为getCell方法无法获取thdxgz。 if(row.getcell(c )==null ) row.createcell ).setcellvalue ) newhssfrichtextstring (string.value of ) row.) }如果}else {//thdxgz具有值,则getCell方法获取thdxgz。 row.getCell(c(c ).setcellvalue ) newhssfrichtextstring (string.value of ) row.getCell(c(c ).getStringCellValue )