Browse Source

Avoid log-spam when using SXSSFWorkbook with auto-sizing

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897324 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_2_1
Dominik Stadler 2 years ago
parent
commit
416562daa5

+ 3
- 1
poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFCell.java View File

@@ -399,7 +399,9 @@ public class SXSSFCell extends CellBase {
return ((RichTextValue)_value).getValue();
else {
String plainText = getStringCellValue();
return getSheet().getWorkbook().getCreationHelper().createRichTextString(plainText);
// don't use the creation-helper here as it would spam the log with one line per row
//return getSheet().getWorkbook().getCreationHelper().createRichTextString(plainText);
return new XSSFRichTextString(plainText);
}
}


+ 16
- 0
poi-ooxml/src/test/java/org/apache/poi/xssf/streaming/TestSXSSFFormulaEvaluation.java View File

@@ -94,6 +94,22 @@ public final class TestSXSSFFormulaEvaluation extends BaseTestFormulaEvaluator
}
}

@Test
void testLogSpam() throws IOException {
try (SXSSFWorkbook wb = new SXSSFWorkbook(5)) {
SXSSFSheet s = wb.createSheet();
s.trackAllColumnsForAutoSizing();

for (int i = 0; i < 20; i++) {
s.createRow(i).createCell(0).setCellValue("1+2");
}

// previously this caused a large number of useless
// log-lines "SXSSF doesn't support Rich Text Strings..."
s.flushRows();
}
}

@Test
void testEvaluateRefOutsideWindowFails() throws IOException {
try (SXSSFWorkbook wb = new SXSSFWorkbook(5)) {

Loading…
Cancel
Save