From 8f5ffb8256530bc2d9a3530dcb7f8b5e86113a64 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Mon, 15 Sep 2008 17:01:46 +0000 Subject: [PATCH] Merged revisions 695264,695303,695420 via svnmerge from https://svn.apache.org:443/repos/asf/poi/trunk ........ r695264 | josh | 2008-09-14 19:55:28 +0100 (Sun, 14 Sep 2008) | 1 line Fix for bug 45978 - removed eager initialisation of SheetReferences ........ r695303 | nick | 2008-09-14 23:19:06 +0100 (Sun, 14 Sep 2008) | 1 line Make a start on exposing the StyleRecord details into HSSFCellStyle, but not fully there yet ........ r695420 | nick | 2008-09-15 12:02:18 +0100 (Mon, 15 Sep 2008) | 1 line Finish exposing the name of Named Cell Styles via HSSFCellStyle (normally held on the parent style though) ........ git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@695549 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/changes.xml | 2 + src/documentation/content/xdocs/status.xml | 2 + .../org/apache/poi/hssf/model/LinkTable.java | 4 - .../org/apache/poi/hssf/model/Workbook.java | 83 +++++++++++++----- .../apache/poi/hssf/record/StyleRecord.java | 5 +- .../poi/hssf/record/formula/Area3DPtg.java | 2 +- .../poi/hssf/record/formula/Ref3DPtg.java | 16 +--- .../poi/hssf/usermodel/HSSFCellStyle.java | 48 ++++++++++ .../poi/hssf/usermodel/HSSFWorkbook.java | 16 ++-- .../apache/poi/hssf/util/SheetReferences.java | 29 ------ .../org/apache/poi/ss/usermodel/Workbook.java | 3 +- .../org/apache/poi/ss/usermodel/Workbook.java | 3 +- .../poi/xssf/usermodel/XSSFWorkbook.java | 17 ++-- .../org/apache/poi/hssf/HSSFTests.java | 24 ++--- .../poi/hssf/data/WithExtendedStyles.xls | Bin 0 -> 6656 bytes .../data/ex45978-extraLinkTableSheets.xls | Bin 0 -> 43520 bytes .../TestEventWorkbookBuilder.java | 13 ++- .../poi/hssf/usermodel/TestCellStyle.java | 54 ++++++++++++ .../poi/hssf/usermodel/TestLinkTable.java | 59 +++++++++++-- .../poi/hssf/util/AllHSSFUtilTests.java | 1 - .../poi/hssf/util/TestSheetReferences.java | 51 ----------- 21 files changed, 258 insertions(+), 174 deletions(-) delete mode 100644 src/java/org/apache/poi/hssf/util/SheetReferences.java create mode 100644 src/testcases/org/apache/poi/hssf/data/WithExtendedStyles.xls create mode 100644 src/testcases/org/apache/poi/hssf/data/ex45978-extraLinkTableSheets.xls delete mode 100644 src/testcases/org/apache/poi/hssf/util/TestSheetReferences.java diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index f07ad2f35..9bb4ec1c7 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -66,6 +66,8 @@ Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx + Expose the name of Named Cell Styles via HSSFCellStyle (normally held on the parent style though) + 45978 - Fixed IOOBE in Ref3DPtg.toFormulaString() due eager initialisation of SheetReferences Made HSSFFormulaEvaluator no longer require initialisation with sheet or row Extended support for cached results of formula cells 45639 - Fixed AIOOBE due to bad index logic in ColumnInfoRecordsAggregate diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 0adf13d18..9c6d8d266 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -63,6 +63,8 @@ Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx + Expose the name of Named Cell Styles via HSSFCellStyle (normally held on the parent style though) + 45978 - Fixed IOOBE in Ref3DPtg.toFormulaString() due eager initialisation of SheetReferences Made HSSFFormulaEvaluator no longer require initialisation with sheet or row Extended support for cached results of formula cells 45639 - Fixed AIOOBE due to bad index logic in ColumnInfoRecordsAggregate diff --git a/src/java/org/apache/poi/hssf/model/LinkTable.java b/src/java/org/apache/poi/hssf/model/LinkTable.java index a64f134fe..2caab0fb5 100755 --- a/src/java/org/apache/poi/hssf/model/LinkTable.java +++ b/src/java/org/apache/poi/hssf/model/LinkTable.java @@ -348,10 +348,6 @@ final class LinkTable { return -1; } - public int getNumberOfREFStructures() { - return _externSheetRecord.getNumOfRefs(); - } - public String resolveNameXText(int refIndex, int definedNameIndex) { int extBookIndex = _externSheetRecord.getExtbookIndexFromRefIndex(refIndex); return _externalBookBlocks[extBookIndex].getNameText(definedNameIndex); diff --git a/src/java/org/apache/poi/hssf/model/Workbook.java b/src/java/org/apache/poi/hssf/model/Workbook.java index 7976588d3..1e37a80ca 100644 --- a/src/java/org/apache/poi/hssf/model/Workbook.java +++ b/src/java/org/apache/poi/hssf/model/Workbook.java @@ -26,7 +26,6 @@ import org.apache.poi.ddf.*; import org.apache.poi.hssf.record.*; import org.apache.poi.hssf.record.formula.NameXPtg; import org.apache.poi.hssf.util.HSSFColor; -import org.apache.poi.hssf.util.SheetReferences; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; @@ -774,6 +773,61 @@ public final class Workbook implements Model { numxfs++; return xf; } + + /** + * Returns the StyleRecord for the given + * xfIndex, or null if that ExtendedFormat doesn't + * have a Style set. + */ + public StyleRecord getStyleRecord(int xfIndex) { + // Style records always follow after + // the ExtendedFormat records + boolean done = false; + for(int i=records.getXfpos(); i= boundsheets.size()) { + // Not sure if this can ever happen (See bug 45798) + return ""; // Seems to be what excel would do in this case + } return getSheetName(indexToSheet); } diff --git a/src/java/org/apache/poi/hssf/record/StyleRecord.java b/src/java/org/apache/poi/hssf/record/StyleRecord.java index 6990a5efd..c6591f550 100644 --- a/src/java/org/apache/poi/hssf/record/StyleRecord.java +++ b/src/java/org/apache/poi/hssf/record/StyleRecord.java @@ -160,7 +160,10 @@ public final class StyleRecord extends Record { public void setName(String name) { field_4_name = name; - //TODO set name length and string options + + // Fix up the length + field_2_name_length = (short)name.length(); + //TODO set name string options } // end user defined diff --git a/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java b/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java index 8848cb603..2183cc2dd 100644 --- a/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/Area3DPtg.java @@ -92,7 +92,7 @@ public final class Area3DPtg extends AreaPtgBase { public String toFormulaString(Workbook book) { // First do the sheet name StringBuffer retval = new StringBuffer(); - String sheetName = Ref3DPtg.getSheetName(book, field_1_index_extern_sheet); + String sheetName = book.findSheetNameFromExternSheet(field_1_index_extern_sheet); if(sheetName != null) { if(sheetName.length() == 0) { // What excel does if sheet has been deleted diff --git a/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java b/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java index dbb00c323..e72cbbc30 100644 --- a/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java @@ -160,20 +160,6 @@ public final class Ref3DPtg extends OperandPtg { } - // TODO - find a home for this method - // There is already a method on Workbook called getSheetName but it seems to do something different. - static String getSheetName(Workbook book, int externSheetIndex) { - // TODO - there are 3 ways this method can return null. Is each valid? - if (book == null) { - return null; - } - - SheetReferences refs = book.getSheetReferences(); - if (refs == null) { - return null; - } - return refs.getSheetName(externSheetIndex); - } /** * @return text representation of this cell reference that can be used in text * formulas. The sheet name will get properly delimited if required. @@ -181,7 +167,7 @@ public final class Ref3DPtg extends OperandPtg { public String toFormulaString(Workbook book) { StringBuffer retval = new StringBuffer(); - String sheetName = getSheetName(book, field_1_index_extern_sheet); + String sheetName = book.findSheetNameFromExternSheet(field_1_index_extern_sheet); if(sheetName != null) { SheetNameFormatter.appendFormat(retval, sheetName); retval.append( '!' ); diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java index 9a3735c4d..76be1f9e5 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java @@ -21,6 +21,7 @@ package org.apache.poi.hssf.usermodel; import org.apache.poi.hssf.model.Workbook; import org.apache.poi.hssf.record.ExtendedFormatRecord; import org.apache.poi.hssf.record.FontRecord; +import org.apache.poi.hssf.record.StyleRecord; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Font; @@ -255,6 +256,22 @@ public class HSSFCellStyle implements CellStyle { return index; } + + /** + * Return the parent style for this cell style. + * In most cases this will be null, but in a few + * cases there'll be a fully defined parent. + */ + public HSSFCellStyle getParentStyle() { + if(format.getParentIndex() == 0) { + return null; + } + return new HSSFCellStyle( + format.getParentIndex(), + workbook.getExFormatAt(format.getParentIndex()), + workbook + ); + } /** * set the data format (must be a valid format) @@ -943,6 +960,37 @@ public class HSSFCellStyle implements CellStyle { return format.getFillForeground(); } + + /** + * Gets the name of the user defined style. + * Returns null for built in styles, and + * styles where no name has been defined + */ + public String getUserStyleName() { + StyleRecord sr = workbook.getStyleRecord(index); + if(sr == null) { + return null; + } + if(sr.getType() == StyleRecord.STYLE_BUILT_IN) { + return null; + } + return sr.getName(); + } + + /** + * Sets the name of the user defined style. + * Will complain if you try this on a built in style. + */ + public void setUserStyleName(String styleName) { + StyleRecord sr = workbook.getStyleRecord(index); + if(sr == null) { + sr = workbook.createStyleRecord(index); + } + if(sr.getType() == StyleRecord.STYLE_BUILT_IN) { + throw new IllegalArgumentException("Unable to set user specified style names for built in styles!"); + } + sr.setName(styleName); + } /** * Verifies that this style belongs to the supplied Workbook. diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index 1d24ad392..dd808a341 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -35,7 +35,6 @@ import org.apache.poi.ddf.EscherBlipRecord; import org.apache.poi.ddf.EscherRecord; import org.apache.poi.hssf.model.Sheet; import org.apache.poi.hssf.model.Workbook; -import org.apache.poi.hssf.model.DrawingManager2; import org.apache.poi.hssf.record.AbstractEscherHolderRecord; import org.apache.poi.hssf.record.BackupRecord; import org.apache.poi.hssf.record.DrawingGroupRecord; @@ -59,7 +58,6 @@ import org.apache.poi.hssf.record.formula.Ptg; import org.apache.poi.hssf.record.formula.Ref3DPtg; import org.apache.poi.hssf.record.formula.UnionPtg; import org.apache.poi.hssf.util.CellReference; -import org.apache.poi.hssf.util.SheetReferences; import org.apache.poi.poifs.filesystem.DirectoryNode; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.usermodel.CreationHelper; @@ -864,8 +862,13 @@ public class HSSFWorkbook extends POIDocument implements org.apache.poi.ss.userm return retval; } - public SheetReferences getSheetReferences() { - return workbook.getSheetReferences(); + /** + * @deprecated for POI internal use only (formula rendering). This method is likely to + * be removed in future versions of POI. + */ + public String findSheetNameFromExternSheet(int externSheetIndex){ + // TODO - don't expose internal ugliness like externSheet indexes to the user model API + return workbook.findSheetNameFromExternSheet(externSheetIndex); } /** @@ -1379,12 +1382,15 @@ public class HSSFWorkbook extends POIDocument implements org.apache.poi.ss.userm } /** - * TODO - make this less cryptic / move elsewhere + * @deprecated for POI internal use only (formula rendering). This method is likely to + * be removed in future versions of POI. + * * @param refIndex Index to REF entry in EXTERNSHEET record in the Link Table * @param definedNameIndex zero-based to DEFINEDNAME or EXTERNALNAME record * @return the string representation of the defined or external name */ public String resolveNameXText(int refIndex, int definedNameIndex) { + // TODO - make this less cryptic / move elsewhere return workbook.resolveNameXText(refIndex, definedNameIndex); } diff --git a/src/java/org/apache/poi/hssf/util/SheetReferences.java b/src/java/org/apache/poi/hssf/util/SheetReferences.java deleted file mode 100644 index d23ed27c6..000000000 --- a/src/java/org/apache/poi/hssf/util/SheetReferences.java +++ /dev/null @@ -1,29 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hssf.util; - -/** - * Holds a collection of Sheet names and their associated - * reference numbers. - * - * @author Andrew C. Oliver (acoliver at apache dot org) - * - */ -public class SheetReferences extends org.apache.poi.ss.util.SheetReferences -{ -} diff --git a/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Workbook.java b/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Workbook.java index a31d03e4c..eca702a37 100644 --- a/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Workbook.java +++ b/src/ooxml/interfaces-jdk14/org/apache/poi/ss/usermodel/Workbook.java @@ -19,7 +19,6 @@ package org.apache.poi.ss.usermodel; import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; import org.apache.poi.hssf.usermodel.*; -import org.apache.poi.hssf.util.SheetReferences; /** * This is a JDK 1.4 compatible interface for HSSFWorkbook. @@ -39,7 +38,7 @@ public interface Workbook { String getSheetName(int sheet); HSSFSheet getSheetAt(int index); - SheetReferences getSheetReferences(); + String findSheetNameFromExternSheet(int externSheetIndex); int getSheetIndex(String name); int getSheetIndex(Sheet sheet); int getSheetIndexFromExternSheetIndex(int externSheetNumber); diff --git a/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Workbook.java b/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Workbook.java index dbc7fdc97..caafc634d 100644 --- a/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Workbook.java +++ b/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Workbook.java @@ -22,7 +22,6 @@ import java.io.OutputStream; import java.util.List; import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; -import org.apache.poi.ss.util.SheetReferences; public interface Workbook { @@ -218,7 +217,7 @@ public interface Workbook { void removeSheetAt(int index); - SheetReferences getSheetReferences(); + String findSheetNameFromExternSheet(int externSheetIndex); /** * determine whether the Excel GUI will backup the workbook when saving. diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index b90058e54..28cee4227 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -39,7 +39,6 @@ import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.StylesSource; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; -import org.apache.poi.ss.util.SheetReferences; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; import org.apache.poi.xssf.model.CommentsTable; @@ -463,6 +462,14 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook { public int getSheetIndexFromExternSheetIndex(int externSheetNumber) { return externSheetNumber; } + /** + * Doesn't do anything special - returns the same as getSheetName() + * TODO - figure out if this is a ole2 specific thing, or + * if we need to do something proper here too! + */ + public String findSheetNameFromExternSheet(int externSheetIndex) { + return getSheetName(externSheetIndex); + } public Sheet getSheet(String name) { CTSheet[] sheets = this.workbook.getSheets().getSheetArray(); @@ -509,14 +516,6 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook { return this.workbook.getSheets().getSheetArray(sheet).getName(); } - public SheetReferences getSheetReferences() { - SheetReferences sr = new SheetReferences(); - for(int i=0; i @@ -41,27 +38,20 @@ import org.apache.poi.hssf.util.TestSheetReferences; */ public final class HSSFTests { - public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); - } - public static Test suite() { - TestSuite suite = new TestSuite("Tests for org.apache.poi.hssf"); - // $JUnit-BEGIN$ + TestSuite suite = new TestSuite(HSSFTests.class.getName()); suite.addTest(AllEventUserModelTests.suite()); suite.addTest(AllModelTests.suite()); suite.addTest(AllUserModelTests.suite()); suite.addTest(AllRecordTests.suite()); + suite.addTest(AllHSSFUtilTests.suite()); - suite.addTest(new TestSuite(TestAreaReference.class)); - suite.addTest(new TestSuite(TestCellReference.class)); - suite.addTest(new TestSuite(TestRangeAddress.class)); - suite.addTest(new TestSuite(TestRKUtil.class)); - suite.addTest(new TestSuite(TestSheetReferences.class)); + if (false) { // TODO - hook this test up + suite.addTest(new TestSuite(TestExcelExtractor.class)); + } suite.addTest(new TestSuite(TestEventRecordFactory.class)); suite.addTest(new TestSuite(TestModelFactory.class)); - // $JUnit-END$ return suite; } } diff --git a/src/testcases/org/apache/poi/hssf/data/WithExtendedStyles.xls b/src/testcases/org/apache/poi/hssf/data/WithExtendedStyles.xls new file mode 100644 index 0000000000000000000000000000000000000000..4a80f56f5dde69729ab1070e6d0f509cd2213622 GIT binary patch literal 6656 zcmeHLU2IfE6h3#`ExYt@`$IvHda1Jg+alY7VhnamsX`)9Thtd4-L|*TvZbco#$sYz z3cP88!NiwFL(&Hgi9gY3j3$=1nqV|0BMl&xKZ18eUZ8EXha6+zeuJSt)J*P*wNMY zLE_}ctDcAX|?u?Giv;6z3DF~f)k$$882LyFT( zP7e>EcAJ)0;fsQJewIN-p?D7~r6A5|p&>+JoGO|zqS4|BS}b#$*CK^+My)S##`VZ4 z4FWvVS_o-Ks&6u`A;EYQB7)*{=^5Wa^UMl&f>4`UPjt)!*xn!;C zN4uo0KjtczPp~gULQE{$%(^t`*sgy{;lo9qLXULYZ0X5PcSPs6>R8 z1mS3#)1mDH?0vubI^6EmA$)7rIz*qWb?DG?Qc=T=BoFSLXKbH`u0v#6rSdrMJO>7P zM}|j-`=fftc&`!BA9=XxaJa{aL<~kl*)!1JZyrp|K3S*m7N*dwdzu{<@aK-3ESczq zX3xI;>+M6wd>3E$NMr3s-_zakoNBwleJC>?by~bWzn*V>) z{FC-Ts);ht#b^kiXYu!GM2<_3`VV#7WM+}_7RdFc9dZw5+SO0P1ZmO^$wRo|9>N#~ zO=cD;<#RriP0FNe6B_Ne8fuUm5nBDqh{qLEvYBS`l?Ty?|7u8X>6S6fe+YM6{`=dH zzkvNpC*(wN_Z+k&k_HWDo6LiIw2LJ#7 literal 0 HcmV?d00001 diff --git a/src/testcases/org/apache/poi/hssf/data/ex45978-extraLinkTableSheets.xls b/src/testcases/org/apache/poi/hssf/data/ex45978-extraLinkTableSheets.xls new file mode 100644 index 0000000000000000000000000000000000000000..5e496142cbb619b83f588c428beaecb8bb6a9736 GIT binary patch literal 43520 zcmeHw349#InQ!&XNE*qPik5h8f`v722do0laoFL`7`AbF2Xc3+N{{q2=7@BdYI zPgl2kMlwe>Y+UpErn~F-zOSmj`l{-ys_yUpZPA+#KfCm&%;GL!PWEmppXCbv67C7O zD`czzHx9tNsZ>h!WDK`w-AAYd{s3OLqVk*o7a#{fb)E-s1M&d{fLVaqfH{D_9mLST~*ntOq{Rxl$%c5+YICpf+OXo_XavH{XtY zk1c%h7P^XYRO+J7nccggk@dXiW=LAN@+hbKOv{5)=;yo9igR<=<14(qLr9{!ngsC%$ps%L`#U^;RhmcT-8~$R?~TR|^+%(J z9zb9rlnq6PNZ@|~|NjC<@Dl%TK*&R>Rjhr>iTR`&s59H=*v8}C#{WzC|6Ke_>`Oe& zkGM}IRM=l3e(LHITIJJtt-(rkNE>ZpL{MsK9E#zZHpUysg_VjK#~a|gh?fG& zSL0)9jD^$2*g9>D3#N%7p#wCRhm{Wr-D&n1)Zy~>kTEY3h7Z%>D3}I^14D`FsJN%4 zl0OX&8ti1EvfNdIP7VW_(p9Bp8_UW(edlfIU8g_vp10h!5efo%%^|H>H_Sn0Qd-R^SMe`^vF9lzH z>$dfQN(IJM7+LkL6Vt7i#YF36Q;J56zA%mwiK#g-)8niOBpVwIqO};rVYrqis;5uW z)f02lV#+-BSyD(I&vMs%_9%@(2M2r0M@B|^%O~KLyB4v}(P*^vA|+nBMf=|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ic-go<3{28Ea1MIQ)s9PGjCH%U6ZF8gUA|xi?6)WldSZY z`}?c(g9z29V)BbxsxdZd@>jQ1 zRaHqh)i!kodODgh^y$59Bs>ttn5VbBGvI3vf+bqa>uo+d2?bDB;YkiS>V93J938xA za8bi#Y0?;iFntWtEPZd@wSVVg3tp9yu8Aerew{aErnSNC-K=v0$NRK1HRoYje(aZX9D5INjlkwQ_eOvGW^(+k zq;Ia<g@k7sjDQ*)rQzUmlEY)#RDar#tHgUI!!HLX}F=1z#AGHeP{*=^9cw#N0E z;?g^=8%lM(GmrrBRwXhPh~mK2(F8H=f!7`-b`6UETEKOH>jAK)VK=wBU*slSKMuHA zd%hLd+W^M_w`+cPXxFT2`E1~yYzf41v=54T44NPN539TlrB(G+UN7FXLIM)#*xpcD z>8q^s)Nl6JG;MAXfdsnC-%wiXtF7By@AU`jya5#uvOUmH>i7BUeD(GImb&@?foC%U z<`i7q8bue>d^CZNP~lrO_{3K9k~szGR#4e+WmR33x2d+;Qyyrk_mo#w23pGNnyahI zJszJYP+wW;@znT^ZQ0{*-jYt`5iocg)V&vVm32ts@u+_R{f@l&CX6k7zy*D4LIVbA zD1#4x4JhDCY^n{FRo;zq<>u;*a&1l3MtO6+XQLdLQ=m511~7)u>KY2gU44}rsx{b# zY9yLr#Cg99M}$`nEw+G3TP+Jke@nCafq(&OoTE#+yeh?Q~+=iY!dX^$T8R+$ToPU z4j-^OWBMmR^r>iw=x@Q`>b^%Bx4glr@XrJLM0QCoCrYC->ejfnPKF`Mh zBym4OV%p0|X)ikz9>Ik_6HZyXFT_ke1)j@d|aveDc>~w*atWV zFb1G}(@cfj?mr!zTb#F5dx&uXuH~pK6d^aS0 - * TODO get OOO documentation updated to reflect this (that EXTERNALBOOK is optional). - * - * It's not clear what exact steps need to be taken in Excel to create such a workbook + * TODO get OOO documentation updated to reflect this (that EXTERNALBOOK is optional). + * + * It's not clear what exact steps need to be taken in Excel to create such a workbook */ public void testLinkTableWithoutExternalBookRecord_bug45046() { HSSFWorkbook wb; @@ -32,16 +32,16 @@ public final class TestLinkTable extends TestCase { // some other sanity checks assertEquals(3, wb.getNumberOfSheets()); String formula = wb.getSheetAt(0).getRow(4).getCell(13).getCellFormula(); - + if ("ipcSummenproduktIntern($P5,N$6,$A$9,N$5)".equals(formula)) { - // The reported symptom of this bugzilla is an earlier bug (already fixed) - throw new AssertionFailedError("Identified bug 41726"); + // The reported symptom of this bugzilla is an earlier bug (already fixed) + throw new AssertionFailedError("Identified bug 41726"); // This is observable in version 3.0 } - + assertEquals("ipcSummenproduktIntern($C5,N$2,$A$9,N$1)", formula); } - + public void testMultipleExternSheetRecords_bug45698() { HSSFWorkbook wb; @@ -56,4 +56,45 @@ public final class TestLinkTable extends TestCase { // some other sanity checks assertEquals(7, wb.getNumberOfSheets()); } + + public void testExtraSheetRefs_bug45978() { + HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex45978-extraLinkTableSheets.xls"); + /* + ex45978-extraLinkTableSheets.xls is a cut-down version of attachment 22561. + The original file produces the same error. + + This bug was caused by a combination of invalid sheet indexes in the EXTERNSHEET + record, and eager initialisation of the extern sheet references. Note - the worbook + has 2 sheets, but the EXTERNSHEET record refers to sheet indexes 0, 1 and 2. + + Offset 0x3954 (14676) + recordid = 0x17, size = 32 + [EXTERNSHEET] + numOfRefs = 5 + refrec #0: extBook=0 firstSheet=0 lastSheet=0 + refrec #1: extBook=1 firstSheet=2 lastSheet=2 + refrec #2: extBook=2 firstSheet=1 lastSheet=1 + refrec #3: extBook=0 firstSheet=-1 lastSheet=-1 + refrec #4: extBook=0 firstSheet=1 lastSheet=1 + [/EXTERNSHEET] + + As it turns out, the formula in question doesn't even use externSheetIndex #1 - it + uses #4, which resolves to sheetIndex 1 -> 'Data'. + + It is not clear exactly what externSheetIndex #4 would refer to. Excel seems to + display such a formula as "''!$A2", but then complains of broken link errors. + */ + + HSSFCell cell = wb.getSheetAt(0).getRow(1).getCell(1); + String cellFormula; + try { + cellFormula = cell.getCellFormula(); + } catch (IndexOutOfBoundsException e) { + if (e.getMessage().equals("Index: 2, Size: 2")) { + throw new AssertionFailedError("Identified bug 45798"); + } + throw e; + } + assertEquals("Data!$A2", cellFormula); + } } diff --git a/src/testcases/org/apache/poi/hssf/util/AllHSSFUtilTests.java b/src/testcases/org/apache/poi/hssf/util/AllHSSFUtilTests.java index ec88e5c43..45c96e6c4 100755 --- a/src/testcases/org/apache/poi/hssf/util/AllHSSFUtilTests.java +++ b/src/testcases/org/apache/poi/hssf/util/AllHSSFUtilTests.java @@ -34,7 +34,6 @@ public class AllHSSFUtilTests { result.addTestSuite(TestHSSFColor.class); result.addTestSuite(TestRangeAddress.class); result.addTestSuite(TestRKUtil.class); - result.addTestSuite(TestSheetReferences.class); return result; } } diff --git a/src/testcases/org/apache/poi/hssf/util/TestSheetReferences.java b/src/testcases/org/apache/poi/hssf/util/TestSheetReferences.java deleted file mode 100644 index 4464d768c..000000000 --- a/src/testcases/org/apache/poi/hssf/util/TestSheetReferences.java +++ /dev/null @@ -1,51 +0,0 @@ - -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - - -package org.apache.poi.hssf.util; - -import junit.framework.TestCase; - -/** - * Tests the SheetReferences class. - * @author Andrew C. Oliver (acoliver at apache dot org) - */ -public class TestSheetReferences - extends TestCase -{ - public TestSheetReferences(String s) - { - super(s); - } - - /** - * Test that the SheetReferences class can add references and give them - * out - */ - public void testSheetRefs() - throws Exception - { - SheetReferences refs = new SheetReferences(); - refs.addSheetReference("A", 0); - refs.addSheetReference("B", 1); - refs.addSheetReference("C", 3); - assertTrue("ref 0 == A", refs.getSheetName(0).equals("A")); - assertTrue("ref 1 == B", refs.getSheetName(1).equals("B")); - assertTrue("ref 3 == C", refs.getSheetName(3).equals("C")); - } -}