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
This commit is contained in:
Dominik Stadler 2022-01-22 06:59:03 +00:00
parent 57e84a8a1a
commit 416562daa5
2 changed files with 19 additions and 1 deletions

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);
}
}

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)) {