Issue 351 - truncate exports to Excel at 256 columns (limitation of Excel format)

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2094 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2011-06-07 23:55:00 +00:00
parent 6a14049652
commit 51c898d602

View File

@ -75,10 +75,14 @@ public class XlsExporter implements StreamExporter {
int cellCount = 0;
for (Column column : project.columnModel.columns) {
org.apache.poi.ss.usermodel.Cell c = r.createCell(cellCount++);
if (cellCount++ > 255) {
// TODO: Warn user about truncated data
} else {
org.apache.poi.ss.usermodel.Cell c = r.createCell(cellCount);
c.setCellValue(column.getName());
}
}
}
{
RowVisitor visitor = new RowVisitor() {
@ -101,12 +105,16 @@ public class XlsExporter implements StreamExporter {
// nothing to do
}
@Override
public boolean visit(Project project, int rowIndex, Row row) {
org.apache.poi.ss.usermodel.Row r = sheet.createRow(rowCount++);
int cellCount = 0;
for (Column column : project.columnModel.columns) {
org.apache.poi.ss.usermodel.Cell c = r.createCell(cellCount++);
if (cellCount++ > 255) {
// TODO: Warn user about truncated data
} else {
org.apache.poi.ss.usermodel.Cell c = r.createCell(cellCount);
int cellIndex = column.getCellIndex();
if (cellIndex < row.cells.size()) {
@ -143,6 +151,7 @@ public class XlsExporter implements StreamExporter {
}
}
}
}
return false;
}
}.init(s, rowCount);