You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2021/11/03 11:12:15 UTC
[Bug 65669] New: Cannot find column with quote
https://bz.apache.org/bugzilla/show_bug.cgi?id=65669
Bug ID: 65669
Summary: Cannot find column with quote
Product: POI
Version: 5.0.x-dev
Hardware: PC
Status: NEW
Severity: major
Priority: P2
Component: XSSF
Assignee: dev@poi.apache.org
Reporter: francis.sourd@sunr.fr
Target Milestone: ---
In a XSSFTable, if a header contains a quote an is used in an expression, it
cannot be found when the expression is parsed. A FormulaParseException is
thrown, notwithstanding the quote is escaped or not.
Exception in thread "main" org.apache.poi.ss.formula.FormulaParseException: One
of the columns Coût fourniture d''électricité (€/mois), Taxes locales (€/mois)
doesn't exist in table Table1
at
org.apache.poi.ss.formula.FormulaParser.parseStructuredReference(FormulaParser.java:805)
In XSSFTable.findColumnIndex(String), in the second to last line, the
replacement should be:
Integer idx = columnMap.get(caseInsensitive(columnHeader.replace("''",
"'")));
instead of
Integer idx = columnMap.get(caseInsensitive(columnHeader.replace("'",
"")));
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65669] Cannot find column with quote
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65669
--- Comment #4 from PJ Fanning <fa...@yahoo.com> ---
I think I get the gist of the test case now - the suggested fix breaks at least
one of the exiting tests -
org.apache.poi.xssf.usermodel.TestXSSFTable.findColumnIndex(TestXSSFTable.java:124
)
So that needs investigation.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65669] Cannot find column with quote
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65669
--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
assertEquals(0, table.findColumnIndex("calc='#*'#"), "column header
has special escaped characters");
So the suggested code breaks this
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65669] Cannot find column with quote
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65669
PJ Fanning <fa...@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
Would it be possible to provide a reproducible test case?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65669] Cannot find column with quote
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65669
--- Comment #3 from PJ Fanning <fa...@yahoo.com> ---
The attached test case has no assertions or checks? What needs to be done to
verify the result?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65669] Cannot find column with quote
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65669
--- Comment #7 from Francis Sourd <fr...@sunr.fr> ---
In my test case, I also tried to escape the quote (with '') in the cell formula
in line 57. But it does not work either.
cell.setCellFormula("Table1[[#This Row],[" + column.replace("'","''") + "1]]");
The column C''olumn1 doesn't exist in table Table1.
XSSFTable.findColumnIndex(String columnName) removes all quotes before
searching for the column index so that it searches for "Column1" in the
columnMap. However, the column is recorded with the quote in the columnMap.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65669] Cannot find column with quote
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65669
--- Comment #2 from Francis Sourd <fr...@sunr.fr> ---
Created attachment 38082
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38082&action=edit
Test case.
Remove quote in line 24 from the column name to have it run.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65669] Cannot find column with quote
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65669
--- Comment #6 from PJ Fanning <fa...@yahoo.com> ---
I added r1894713 but this needs more work - still need to work out what other
special chars that we need to support - so far handles:
* apostrophe (')
* #
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org