diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index 58af02a0c..e4f8c8ecd 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -36,6 +36,7 @@ + 43116 - [PATCH] - Fix for Escher layer handling of embeded OLE2 documents 43108 - [PATCH] - Where permissions deny fetching System Properties, use sensible defaults 43093 - [PATCH] - Fix formula evaluator support for Area3D references to other sheets Improvements to HSSFDateUtils.isADateFormat, and have HSSFDateUtil.isCellDateFormatted use this diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 04ee81639..bceda3644 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -33,6 +33,7 @@ + 43116 - [PATCH] - Fix for Escher layer handling of embeded OLE2 documents 43108 - [PATCH] - Where permissions deny fetching System Properties, use sensible defaults 43093 - [PATCH] - Fix formula evaluator support for Area3D references to other sheets Improvements to HSSFDateUtils.isADateFormat, and have HSSFDateUtil.isCellDateFormatted use this diff --git a/src/java/org/apache/poi/ddf/EscherBlipRecord.java b/src/java/org/apache/poi/ddf/EscherBlipRecord.java index 9ec3be30e..2c31f3f57 100644 --- a/src/java/org/apache/poi/ddf/EscherBlipRecord.java +++ b/src/java/org/apache/poi/ddf/EscherBlipRecord.java @@ -92,7 +92,7 @@ public class EscherBlipRecord */ public int getRecordSize() { - return field_pictureData.length + 4; + return field_pictureData.length + HEADER_SIZE; } /** diff --git a/src/testcases/org/apache/poi/hssf/data/ole2-embedding.xls b/src/testcases/org/apache/poi/hssf/data/ole2-embedding.xls new file mode 100644 index 000000000..521082b69 Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/ole2-embedding.xls differ diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java b/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java new file mode 100644 index 000000000..b0fd77b88 --- /dev/null +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java @@ -0,0 +1,26 @@ +package org.apache.poi.hssf.usermodel; + +import java.io.File; +import java.io.FileInputStream; + +import junit.framework.TestCase; + +public class TestOLE2Embeding extends TestCase { + public void testEmbeding() throws Exception { + String dirname = System.getProperty("HSSF.testdata.path"); + String filename = dirname + "/ole2-embedding.xls"; + + File file = new File(filename); + FileInputStream in = new FileInputStream(file); + HSSFWorkbook workbook; + + // This used to break, until bug #43116 was fixed + workbook = new HSSFWorkbook(in); + + in.close(); + + // Check we can get at the Escher layer still + workbook.getAllPictures(); + } +} +