Return-Path: X-Original-To: apmail-poi-user-archive@www.apache.org Delivered-To: apmail-poi-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E57C39AF7 for ; Tue, 31 Jan 2012 08:16:21 +0000 (UTC) Received: (qmail 73469 invoked by uid 500); 31 Jan 2012 08:16:21 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 72666 invoked by uid 500); 31 Jan 2012 08:16:08 -0000 Mailing-List: contact user-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Users List" Delivered-To: mailing list user@poi.apache.org Received: (qmail 72622 invoked by uid 99); 31 Jan 2012 08:16:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2012 08:16:05 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [72.249.145.133] (HELO scm.macrohmasheen.com) (72.249.145.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2012 08:15:56 +0000 Received: from [10.0.1.100] (unknown [209.90.234.203]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by scm.macrohmasheen.com (Postfix) with ESMTPSA id BE8401FA44B7 for ; Tue, 31 Jan 2012 03:15:34 -0500 (EST) Message-ID: <4F27A329.2020200@macrohmasheen.com> Date: Tue, 31 Jan 2012 00:15:37 -0800 From: Raindog User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091205 Shredder/3.0 (tete009 SSE PGO) MIME-Version: 1.0 To: user@poi.apache.org Subject: Re: Extracting a byte[] of a record. References: <4F234388.1090006@macrohmasheen.com> <1327850737578-5439538.post@n5.nabble.com> <4F2793DA.2060905@macrohmasheen.com> <1327995097479-5443859.post@n5.nabble.com> In-Reply-To: <1327995097479-5443859.post@n5.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 1/30/2012 11:31 PM, Mark Beardsley wrote: > Well, if you look at the original examples code, these two lines are the key > I think; > > HSSFObjectData obj : workbook.getAllEmbeddedObjects() > > which is actually a shorter way of saying this; > > HSSFObjectData[] objs - workbook.getAllEmbeddedObjects(); > for(HSSFObjectData obj : objs) { > ... > } > > That retrieves all of the embedded onjects as instances of the > HSSFObjectData class. > > Then this line > > byte[] objectData = obj.getObjectData(); > > allows you to get at the data of each embeded object. At it's most basic, > all I thin you need to so is this; > > 1. Get the ambedded objects > 2. Look at their data and so > > HSSFObjectData[] objs - workbook.getAllEmbeddedObjects(); > for(HSSFObjectData obj : objs) { > byte[] objectData = obj.getObjectData(); > byte firstByte = objectData[0]; > } > > You do not need any of the other code IMO - unless you are doing something > more involved. Give those four lines a try and see what happens. > > Yours > > Mark B > If I do that, the only objects I get are: Paint.Picture Packager Shell Object The length of the byte[] getObjectData returns is 0. If I iterate over the entires in the Packager Shell Object (which is the object containing the embedded exe), I get the following children (The last number is object size via DocumentEntry.getSize(): Packager Shell Object.CompObj 76 Packager Shell Object.Ole10Native 180012 <--- these are the bytes I want, the Ole10Native entry is not contained in the output from workbook.getAllEmbeddedObjects() --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org