From 26163ce8e53ab061410cea2ff0be90322b481375 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 15 Aug 2007 14:40:02 +0000 Subject: [PATCH] Patch from Trejkaz from bug #43116 - Fix for Escher handling of embeded OLE2 documents git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@566196 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/changes.xml | 1 + src/documentation/content/xdocs/status.xml | 1 + .../org/apache/poi/ddf/EscherBlipRecord.java | 2 +- .../apache/poi/hssf/data/ole2-embedding.xls | Bin 0 -> 41472 bytes .../poi/hssf/usermodel/TestOLE2Embeding.java | 26 ++++++++++++++++++ 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/testcases/org/apache/poi/hssf/data/ole2-embedding.xls create mode 100644 src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index 58af02a0c4..e4f8c8ecda 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 04ee816395..bceda3644f 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 9ec3be30e6..2c31f3f57d 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 0000000000000000000000000000000000000000..521082b6972e54575bd83a6301892a3d537937f7 GIT binary patch literal 41472 zcmeHw3qaJx_W$gImyZ?^pP8;`il&5uk9>k4Qa;!KQwsxxMbL$%-Ni>{t*PA}YL?#0 zG_|XxJvFnZnv|Axvr_X>-BPb+W_i1m_R@6!pU-@EU|GSifBm}mx&!AsGiPSbIdf*_ zd}ro6`~B|tpwYocpKJL~;pYYjgE;F66Tv=s9l`|Z!Ub|@@v|O}$BPvR2Hby<2F^fM zJsK|vz;&wGD*>^9Zh-CprpLqY0q6!1PlTs0g?fO0V#kXfK7KNs3!uqc7=5K~dRy1S<6IZ6Sv2j)=rCLzk@RjN|ByFIrtZvQsj@;SQ5c=$%7 zx!FPBMuEFSOcdj!91}I<1zaP9UdO(tWT;EgIAr>Sodj+;T0a>*sV90sBA_>V5c@=3 zU2|AO#hYWO(cBsNi_<=6bjMfXN%2ajFG=TM%9+Nj_raGu()XoZo&O*aFXCjM_RVv? zF!<|q$j}JD@fjR;uKpGOoC+cJ?@LdIQEU@dU(^MK>p}mj{`Biwm}8Jm2c6qRu_%Qc z!0pKl>ByRbBa0Uu9k%7EvVf(C^F83$4QG#n#;;{|l`@ZHMBJBsr5eN1s`Y zgbY^5Qdief=;b|{cDk_73f*?-LP?w$*=v z!&uPsKCc|_twwebxN>Sc+6!D}i+!@yVX+sLxXc;0qI|2ILJZHaIIK=M|}i3j|%tP5$#s++r2#L<}An(b%w8b%Q;gFeN$pQ7&W0nrw5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TVO zGqwx)p5YSQL->i`fV;Rf5NQ94tG)eeTlI+0KP3>q7&O2=e2cfD>RwS^UM?}p_a;k^ z`{>M4OpCYB3m}69~AAQ3L(Z1In<1)xJZ(m26(+ zhrcgIeFW-UR}J`^mSrgDi(}XqXpd9|->~oAn!+oeMFK9M0ct>x&h%^dvw)_mYruCr zR!<4U0vf1U1DtOL`c2Kc31BZS4RCJ4pG-STZIkVjd&b9Dr{LL1^?8l&9Ow58t2t0@ zzHdwDY8bFdIH8#(M#*PW`Iz5N#&fGIKq;PGO_uSVcxD`f-N-3`fctYa&`(V8odEyA zLS*6x`DNIFo>=+BG6Vg=jz50f)gjDS4O*}t!0)~lAkI~xS;XP=g4z3-!#`NSUm?$r zJ#zm%;C`D19>o#QF!{8EPfheVJ2Kka`wn{dmJSZo;aN8i+z7oqhbj+1x1{tZ%+s^*pDey$qsaAY&{gZCe6k%+FY8!als{vjCxJ9CN({F9Lm^ zr*tZkksT*=DtP>ZPk(s$hF`kx0zALs9t|8$$H=b-B3RAoMLk)LZ~P2G3iD5bzs{)P zal%G~L%bC@rqmC3?U<4=5ol3gnpP+U)U|_4Gj)j&bF(fS@@R*cJUDh6Dh8qotVOsy z>co>drHBoMv^xxXaR}i?6}aHp&j=h|ia-gRJjx-)9oCnu@CyvR)I6z#;b?hlNSm*J zMz41rIVB9xj^Br`yRHAbe0X(S+B$H1Jv}x6M~w@>_w?KX;Cpsv0r;MtIRKpJ6fXd1&ivoM%-&ho_wg`q2tfNi zL{+eRRWMHYzN?1=Gjr*ApGBrk42Da|xRqJljX#K}t{~sx^XO#c| literal 0 HcmV?d00001 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 0000000000..b0fd77b889 --- /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(); + } +} +