Patch from bug #46092 - fix hssf dev utility

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@708252 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-10-27 17:59:39 +00:00
parent 9ab8e8bd0e
commit 8c00f57775

View File

@ -221,7 +221,7 @@ public class HSSF
if (args.length < 2)
{
/* try
try
{
HSSF hssf = new HSSF(args[ 0 ]);
@ -230,26 +230,30 @@ public class HSSF
for (int k = 0; k < wb.getNumberOfSheets(); k++)
{
System.out.println("Sheet " + k);
HSSFSheet sheet = wb.getSheetAt(k);
int rows = sheet.getPhysicalNumberOfRows();
System.out.println("Sheet " + k + " \""
+ wb.getSheetName(k) + "\" has "
+ rows + " row(s).");
for (int r = 0; r < rows; r++)
{
HSSFRow row = sheet.getPhysicalRowAt(r);
int cells = row.getPhysicalNumberOfCells();
System.out.println("ROW " + row.getRowNum());
HSSFRow row = sheet.getRow(r);
int cells = (row != null) ? row.getPhysicalNumberOfCells() : 0;
if (row != null) {
System.out.println("\nROW " + row.getRowNum()
+ " has " + cells + " cell(s).");
}
for (int c = 0; c < cells; c++)
{
HSSFCell cell = row.getPhysicalCellAt(c);
HSSFCell cell = row.getCell(c);
String value = null;
switch (cell.getCellType())
{
case HSSFCell.CELL_TYPE_FORMULA :
value = "FORMULA ";
value = "FORMULA value="
+ cell.getCellFormula();
break;
case HSSFCell.CELL_TYPE_NUMERIC :
@ -274,7 +278,7 @@ public class HSSF
catch (Exception e)
{
e.printStackTrace();
}*/
}
}
else if (args.length == 2)
{