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 2008/02/13 18:33:52 UTC
DO NOT REPLY [Bug 44417] New: - CellReference.getSheetName() returns a String which HSSFSheet.getSheet() does not find
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44417>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=44417
Summary: CellReference.getSheetName() returns a String which
HSSFSheet.getSheet() does not find
Product: POI
Version: 3.0
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: HSSF
AssignedTo: dev@poi.apache.org
ReportedBy: breaux@users.sourceforge.net
Following the example from
http://poi.apache.org/hssf/quick-guide.html#NamedRanges
I have the following code:
int cellIndex = workbook.getNameIndex(cellName);
HSSFName name = workbook.getNameAt(cellIndex);
AreaReference aref = new AreaReference(name.getReference());
// assume a single cell in named area
CellReference cref = aref.getAllReferencedCells()[0];
log.debug(cellName + ": " +
cref.getSheetName() + ", " + cref.getRow() +
", " + cref.getCol());
HSSFSheet s = workbook.getSheet(cref.getSheetName());
Unfortunately, the getSheet() call returns null. In the logging line above,
getSheetName() shows single quotes around the name. If I remove those single
quotes, the getSheet() call works correctly.
i.e.:
HSSFSheet s = workbook.getSheet(cref.getSheetName().replaceAll("'", ""));
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 44417] - CellReference.getSheetName() returns a String which HSSFSheet.getSheet() does not find
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44417>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=44417
------- Additional Comments From josh@gildedtree.com 2008-02-13 22:32 -------
Created an attachment (id=21525)
--> (http://issues.apache.org/bugzilla/attachment.cgi?id=21525&action=view)
svn diffs for 16 changed files
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 44417] - [patch] CellReference.getSheetName() returns a String which HSSFSheet.getSheet() does not find
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44417>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=44417
nick@torchbox.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From nick@torchbox.com 2008-02-15 04:05 -------
Thanks for the patch Josh. I'd been planning to do something similar, but it
looks from your work that it was a bigger job than I'd expected, so it's great
you did it instead of me :)
Patch applied to svn
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 44417] - CellReference.getSheetName() returns a String which HSSFSheet.getSheet() does not find
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44417>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=44417
------- Additional Comments From josh@gildedtree.com 2008-02-13 22:32 -------
Created an attachment (id=21526)
--> (http://issues.apache.org/bugzilla/attachment.cgi?id=21526&action=view)
tar bz2 of one added test case
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 44417] - [patch] CellReference.getSheetName() returns a String which HSSFSheet.getSheet() does not find
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44417>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=44417
josh@gildedtree.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|CellReference.getSheetName()|[patch]
|returns a String which |CellReference.getSheetName()
|HSSFSheet.getSheet() does |returns a String which
|not find |HSSFSheet.getSheet() does
| |not find
------- Additional Comments From josh@gildedtree.com 2008-02-13 22:35 -------
Added patch to fix this bug.
The example provided was not explicit, but it is assumed that the sheet name
had special characters in it (probably a space). There has been a recent
change (44336) that causes "name.getReference()" in the example to return
quoted sheet names if any special characters are present. The required fix is
to make AreaReference and CellReference handle sheet names with special
characters.
Fixed AreaReference.separateAreaRefs() to only consider cell delimiters (:)
outside quoted sheet names.
Fixed CellReference.separateRefParts() to handle sheet names with special
characters (assuming properly delimited).
Made sure CellReference.getSheetName() returns a raw sheet name.
Changed AreaReference to model its 2 CellReference components as first class
fields 'firstCell' and 'lastCell' instead of an array.
Created new methods "formatAsString()" on AreaReference and CellReference and
moved important logic out of toString(). Added javadoc.
Replaced all references to AreaReference.toString() and CellReference.toString
() with calls to formatAsString().
Added test cases to existing junits TestAreaReference and TestCellReference.
Added test suite for org.apache.poi.hssf.util package.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 44417] - [patch] CellReference.getSheetName() returns a String which HSSFSheet.getSheet() does not find
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44417>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=44417
------- Additional Comments From breaux@users.sourceforge.net 2008-02-14 06:36 -------
Actually, that's correct, which I meant to include in the initial description.
That is, in this case, the Sheet name contains spaces in it. Thanks for the
quick response.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org