Bug 66401 - FormulaParser does not recognize sheet names containing quotes
Summary: FormulaParser does not recognize sheet names containing quotes
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 5.2.2-FINAL
Hardware: PC All
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
Keywords: PatchAvailable
Depends on:
Reported: 2022-12-26 07:43 UTC by mirko.scotti
Modified: 2022-12-26 16:21 UTC (History)
0 users

FormulaParser.java (74.09 KB, text/x-csrc)
2022-12-26 07:43 UTC, mirko.scotti

Note You need to log in before you can comment on or make changes to this bug.
Description mirko.scotti 2022-12-26 07:43:28 UTC
Created attachment 38454 [details]

I have an Excel file with a sheet whose name contains a quote. This name is referenced in a formula on a cell of a different sheet. 


Sheet name -> Valle d'Aosta
Sheet reference in formula -> 'Valle d''Aosta'!A1

The FormulaParser creates a Ref3DPxg instance having:

_firstSheetName -> Valle dAosta

I have found this issue in version 5.2.3. FormulaParser eats the two consecutive quotes at line 1185 when, once they are detected, it scrolls to the next char without appending them to the string builder.

Adding at line 1185 of FormulaParser the following statement solved my issue.


See the patched FormulaParser.java. I wonder if you could insert this fix in the next release.
Comment 1 Dominik Stadler 2022-12-26 16:21:21 UTC
Applied the suggested change via r1906217

Thanks for the investigation and suggestion!