poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 46670] Reference to cell in different workbook not possible
Date Sun, 17 May 2015 21:53:32 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=46670

--- Comment #12 from Dominik Stadler <dominik.stadler@gmx.at> ---
I tried to work on this for the XSSF side, the following will parse the
bookname when the formula is parsed, although the unit test does not build the
"ExternalLinkTable" and thus the unit tests still fails and I could not see how
that can be fixed correctly in the test or in the product code.

diff --git a/src/java/org/apache/poi/ss/formula/FormulaParser.java
b/src/java/org/apache/poi/ss/formula/FormulaParser.java
index 72ed008..6940a71 100644
--- a/src/java/org/apache/poi/ss/formula/FormulaParser.java
+++ b/src/java/org/apache/poi/ss/formula/FormulaParser.java
@@ -792,6 +792,18 @@ public final class FormulaParser {
                        StringBuffer sb = new StringBuffer();

                        Match('\'');
+                       // try again to read external workbook-name as it could
have been enclosed in the single quotes
+                       if (look == '[') {
+                               StringBuilder sbBook = new StringBuilder();
+                               GetChar();
+                               while (look != ']') {
+                                       sbBook.append(look);
+                                       GetChar();
+                               }
+                               GetChar();
+                               bookName = sbBook.toString();
+                       }
+
                        boolean done = look == '\'';
                        while(!done) {
                                sb.append(look);

-- 
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


Mime
View raw message