Bug 25457 - [PATCH] Formula Parser doesn't allow ' around worksheet names and others
Summary: [PATCH] Formula Parser doesn't allow ' around worksheet names and others
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-pre3
Hardware: All other
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-11 21:07 UTC by Peter M. Murray
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
patch for single-ticks around worksheet names (3.70 KB, patch)
2003-12-11 21:09 UTC, Peter M. Murray
Details | Diff
UPDATED: patch for single-ticks around worksheet names against REL_2_BRANCH (4.87 KB, patch)
2003-12-12 16:07 UTC, Peter M. Murray
Details | Diff
UPDATED UPDATED: patch for multiple issues including the ' around sheet names patch. (11.16 KB, patch)
2003-12-18 20:55 UTC, Peter M. Murray
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter M. Murray 2003-12-11 21:07:14 UTC
In Excel, worksheets with spaces and/or weird characters in their names can be 
referred to using single-ticks.  For instance: 'Profit and Loss'!A3..A5

The patch I'm submitting allows formulas to surround worksheet names with 
single-ticks.  As a side-effect it allows one to surround regular cell 
references with single-ticks in certain cases.  The parser seemed to be 
generous about these cases in general, so I assumed it would be ok.

This patch was generated against the REL_2_0_RC1 tagged version.  Please let 
me know if you'd like it against the tip of REL_2_BRANCH and/or the HEAD 
itself.
Comment 1 Peter M. Murray 2003-12-11 21:09:06 UTC
Created attachment 9524 [details]
patch for single-ticks around worksheet names
Comment 2 Peter M. Murray 2003-12-11 21:10:36 UTC
Oh yeah, I also had problems creating the custom palette in this version.  The 
attached patch has a one-line comment which fixed the problem for me.  In 
createWorkbook, the palette index was being set when we didn't have a custom 
palette record yet.  I just commented out the line and it seemed to fix the 
problem. 
Comment 3 Andy Oliver 2003-12-12 00:26:11 UTC
We need a unit test for it.  Please do it against the (2.0) branch as opposed to
an already released RC.  Thanks!
Comment 4 Peter M. Murray 2003-12-12 16:07:31 UTC
Created attachment 9541 [details]
UPDATED: patch for single-ticks around worksheet names against REL_2_BRANCH
Comment 5 Peter M. Murray 2003-12-18 20:55:52 UTC
Created attachment 9632 [details]
UPDATED UPDATED: patch for multiple issues including the ' around sheet names patch.
Comment 6 Peter M. Murray 2003-12-18 21:00:00 UTC
I've updated the patch file (take the latest one) - it now includes the 
following fixes:

1) Allow ' around worksheet names in references
2) Parse and properly handle unary minus - (e.g. -A2)
3) Fix bug with parser eating leading spaces in strings (e.g. "  hi" 
becomes "hi")
4) Fix bug with initial argument to LOOKUP and MATCH functions not having 
proper ptg class (REF instead of VALUE).

All four issues are pretty simple code changes and all have test cases built 
into the FormulaParser test class.

Avik - I didn't have time today to do separate diffs.  Hopefully you can find 
you way through the one diff file.  They are all pretty simple code changes 
and have been excercised in many different scenarios through our application 
Q/A process.
Comment 7 Avik Sengupta 2004-01-01 07:52:53 UTC
Applied to both branch and HEAD. Thanks a lot, Peter. Sorry for the delay.