https://issues.apache.org/bugzilla/show_bug.cgi?id=57523
Bug ID: 57523
Summary: Some cells reporting as blank when they aren't
Product: POI
Version: 3.10-FINAL
Hardware: PC
OS: Mac OS X 10.4
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Created attachment 32424
--> https://issues.apache.org/bugzilla/attachment.cgi?id=32424&action=edit
XSSF some nonblank cells reporting as blank
My code just exports the Attributes tab of the attached spreadsheet.
The problematic cells are:
Attribute Master tab
Row 16
Columns N and P (values 500 and 10) reported as blank.
There are some others
When I open the XLS in LibreOffice, the affected rows are SLIGHTLY thicker
vertically than others. Strange.
code:
public List<String[]> extractList(XSSFSheet tab, Integer columnWidthLimit,
boolean padToWidth, boolean skipHeaderRow)
{
List<String[]> rows = new ArrayList<>();
Iterator<Row> rowIterator = tab.iterator();
boolean first = true;
while (rowIterator.hasNext())
{
if (skipHeaderRow && first)
{
first = false;
continue;
}
Row row = rowIterator.next();
Iterator<Cell> cellIterator = row.cellIterator();
int cellCount = 0;
List<String> rowData = new ArrayList<>();
while (cellIterator.hasNext())
{
if (columnWidthLimit != null && cellCount >= columnWidthLimit)
{
break;
}
Cell cell = cellIterator.next();
if (cellCount == 5)
{
System.out.println("" + rowData.get(4));
}
if (cellCount > 5)
{
System.out.print("::" + cellCount + "::" + cell.getCellType() +
"::");
}
switch (cell.getCellType())
{
case Cell.CELL_TYPE_BOOLEAN:
rowData.add("" + cell.getBooleanCellValue());
break;
case Cell.CELL_TYPE_NUMERIC:
rowData.add("" + cell.getNumericCellValue());
break;
case Cell.CELL_TYPE_STRING:
rowData.add("" + cell.getStringCellValue());
break;
case Cell.CELL_TYPE_BLANK:
rowData.add("");
break;
case Cell.CELL_TYPE_FORMULA:
rowData.add("#FORMULA");
break;
case Cell.CELL_TYPE_ERROR:
rowData.add("#ERROR");
break;
default:
rowData.add("#UNKNOWN");
break;
}
if (cellCount > 5)
{
System.out.println(rowData.get(rowData.size() - 1));
}
cellCount++;
}
if (padToWidth && columnWidthLimit != null)
{
if (cellCount < columnWidthLimit)
{
for (int i = cellCount; i < columnWidthLimit; i++)
{
rowData.add("");
}
}
}
rows.add(rowData.toArray(new String[rowData.size()]));
}
return rows;
}
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]