From 0102c6649807c1c32a6118f895a66dce12ca221b Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Mon, 3 Mar 2008 15:26:38 +0000 Subject: [PATCH] Patch from Josh from bug #44495 - Handle named cell ranges in formulas that have lower case parts git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@633126 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/changes.xml | 1 + src/documentation/content/xdocs/status.xml | 1 + src/java/org/apache/poi/hssf/model/FormulaParser.java | 2 +- src/java/org/apache/poi/hssf/record/formula/NamePtg.java | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index f043de44b..d85e3a3a7 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -36,6 +36,7 @@ + 44495 - Handle named cell ranges in formulas that have lower case parts 44491 - Don't have the new-style "HPSF properties are always available" affect the old-style use of HPSF alongside HSSF 44471 - Crystal Reports generates files with short StyleRecords, which isn't allowed in the spec. Work around this 44450 - Support for Lookup, HLookup and VLookup functions diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 66c348de6..4b836f6a9 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -33,6 +33,7 @@ + 44495 - Handle named cell ranges in formulas that have lower case parts 44491 - Don't have the new-style "HPSF properties are always available" affect the old-style use of HPSF alongside HSSF 44471 - Crystal Reports generates files with short StyleRecords, which isn't allowed in the spec. Work around this 44450 - Support for Lookup, HLookup and VLookup functions diff --git a/src/java/org/apache/poi/hssf/model/FormulaParser.java b/src/java/org/apache/poi/hssf/model/FormulaParser.java index 1d78b1b23..dc75a5c17 100644 --- a/src/java/org/apache/poi/hssf/model/FormulaParser.java +++ b/src/java/org/apache/poi/hssf/model/FormulaParser.java @@ -327,7 +327,7 @@ public class FormulaParser { for(int i = 0; i < book.getNumNames(); i++) { // Our formula will by now contain an upper-cased // version of any named range names - if(book.getNameRecord(i).getNameText().toUpperCase().equals(name)) { + if(book.getNameRecord(i).getNameText().equalsIgnoreCase(name)) { nameRecordExists = true; } } diff --git a/src/java/org/apache/poi/hssf/record/formula/NamePtg.java b/src/java/org/apache/poi/hssf/record/formula/NamePtg.java index d418afa7e..01323c3a0 100644 --- a/src/java/org/apache/poi/hssf/record/formula/NamePtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/NamePtg.java @@ -50,7 +50,7 @@ public class NamePtg NameRecord rec; for (short i = 1; i < n; i++) { rec = book.getNameRecord(i - 1); - if (name.equals(rec.getNameText())) { + if (name.equalsIgnoreCase(rec.getNameText())) { field_1_label_index = i; return; }