mirror of https://github.com/apache/poi.git
[bug-66855] Formula parser incorrectly handles sheet name containing multiple single quotes in a row. Thanks to Kirill lebedev. This closes #496
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911589 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a6a37bd0f0
commit
d152861036
|
@ -1182,8 +1182,6 @@ public final class FormulaParser {
|
|||
if (look == '\''){
|
||||
// Any single quotes which were already present in the sheet name will be converted to double single quotes ('')
|
||||
// so switch back to single quote
|
||||
sb.appendCodePoint(look);
|
||||
nextChar();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1371,6 +1371,22 @@ final class TestFormulaParser {
|
|||
wb.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testParseSheetNameWithMultipleSingleQuotes() throws IOException {
|
||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||
wb.createSheet("Sh''t1");
|
||||
Ptg[] ptgs = parse("'Sh''''t1'!$A:$A,'Sh''''t1'!$1:$4", wb);
|
||||
confirmTokenClasses(ptgs,
|
||||
MemFuncPtg.class,
|
||||
Area3DPtg.class,
|
||||
Area3DPtg.class,
|
||||
UnionPtg.class
|
||||
);
|
||||
assertEquals(0, ((Area3DPtg)ptgs[1]).getExternSheetIndex());
|
||||
assertEquals(0, ((Area3DPtg)ptgs[2]).getExternSheetIndex());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExplicitRangeWithTwoSheetNames() throws IOException {
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
|
|
Loading…
Reference in New Issue