diff options
author | Nick Burch <nick@apache.org> | 2013-02-07 21:53:07 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2013-02-07 21:53:07 +0000 |
commit | c5b2f7dc7f66cf07502e033aafaeaafd0210e885 (patch) | |
tree | 32d4323534bae62df6329fd78ed5e55a5b52fdeb /src/java | |
parent | 76edd0fc3f510fee1ac1bb52dd0b9bc910625943 (diff) | |
download | poi-c5b2f7dc7f66cf07502e033aafaeaafd0210e885.tar.gz poi-c5b2f7dc7f66cf07502e033aafaeaafd0210e885.zip |
Fix bug #54506 - Add "BOOK" to the list of unusual-but-largely-ok Workbook directory entry names list, alongside WORKBOOK, plus tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1443745 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index c218775886..f3076d3ccc 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -193,7 +193,8 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss */ private static final String[] WORKBOOK_DIR_ENTRY_NAMES = { "Workbook", // as per BIFF8 spec - "WORKBOOK", + "WORKBOOK", // Typically from third party programs + "BOOK", // Typically odd Crystal Reports exports }; @@ -1180,9 +1181,11 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss if (preserveNodes) { // Don't write out the old Workbook, we'll be doing our new one excepts.add("Workbook"); - // If the file had WORKBOOK instead of Workbook, we'll write it - // out correctly shortly, so don't include the old one - excepts.add("WORKBOOK"); + // If the file had an "incorrect" name for the workbook stream, + // don't write the old one as we'll use the correct name shortly + for (String wrongName : WORKBOOK_DIR_ENTRY_NAMES) { + excepts.add(wrongName); + } // Copy over all the other nodes to our new poifs copyNodes(this.directory, fs.getRoot(), excepts); |