Return-Path: Delivered-To: apmail-poi-user-archive@www.apache.org Received: (qmail 61993 invoked from network); 13 Oct 2010 17:41:04 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Oct 2010 17:41:04 -0000 Received: (qmail 575 invoked by uid 500); 13 Oct 2010 17:41:03 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 545 invoked by uid 500); 13 Oct 2010 17:41:02 -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 537 invoked by uid 99); 13 Oct 2010 17:41:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Oct 2010 17:41:02 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of thyde@centraldesktop.com designates 66.226.4.143 as permitted sender) Received: from [66.226.4.143] (HELO mail0.centraldesktop.com) (66.226.4.143) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Oct 2010 17:40:55 +0000 Received: from mail0.centraldesktop.com (localhost [127.0.0.1]) by mail0.centraldesktop.com (Postfix) with ESMTP id 479D22E026 for ; Wed, 13 Oct 2010 10:40:33 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=centraldesktop.com; h= content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; q=dns; s= selector1; b=AcO+YPLlfSqW6nM4nTHa/DNvpVln/awb/XzN2w37gEENl7AVv+L bhwE3SfMIYdfF6CC1izTz+oralESJVSjaApWTwFe/b2dz9PjOjd4wGIswh0RzeBJ 1/D25v5fwsWHgJUi9NUy58IhNUuN33ZAcNxLJR2RYwkMleqONihSbP/0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=centraldesktop.com; h= content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; s=selector1 ; bh=9naqamPBfx9tig/oscTQnbXeDF8=; b=mzlghda9zJxpyHpgsto830D5Icp W2TZaN0fvTrGnPYxle77Aob4ilqNXplkn4KU8w3+4bvW+b+vBpso1S1f/YiZ+Nc0 m/4vcAA5YQpwDYmqb04MVU9Ty0ISTa5bUjvodxeO+WjV0IuxGPaUgSLAcT2auKt3 oUaeD8vCXbDzxZbM= Received: from trey-hydes-mac-pro.local (adsl-99-24-6-121.dsl.lsan03.sbcglobal.net [99.24.6.121]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: thyde@centraldesktop.com) by mail0.centraldesktop.com (Postfix) with ESMTPSA id 1B5402E024 for ; Wed, 13 Oct 2010 10:40:33 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) Subject: Re: Issues losing a drawing part when saving an ooxml filesystem From: Trey Hyde In-Reply-To: Date: Wed, 13 Oct 2010 10:40:32 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <9CAA6E96-E2F6-4319-9635-C459BC81B0A5@centraldesktop.com> References: <1F2FF01C-F6F9-41BD-ACD3-DF9902FB18B0@centraldesktop.com> To: "POI Users List" X-Mailer: Apple Mail (2.1081) X-Virus-Checked: Checked by ClamAV on apache.org On Oct 13, 2010, at 2:37 AM, Nick Burch wrote: > On Tue, 12 Oct 2010, Trey Hyde wrote: >> I've been injecting custom document properties with POI in both OOXML = and OLE files for about 4 months now covering a very large number of = documents. I do have one customer complaining when they open my = meta-data injected version of their file that Excel complains about a = missing drawing part. >=20 > Do all files with drawings get affected, or only some? For a file that = will display the problem, if you open and save (without making any = changes) do you see the problem? Or is it only after you make other = changes that the drawing gets lost? The drawings all seem intact but only tangible difference I see is the = missing hyperlink rel in drawing1. I just modified the code to not = actually make any changes and I see the same thing. See the code = below. The commented region is what the core of my utility does ... = Open the pakage, open the props, add / modify custom properties, commit = the properties, save a copy of the package. Just doing that (even = when not executing the property part) is dropping that rId1 hyperlink = relation which is causing Excel 2007 to freak out. Mac Office doesn't = complain. I'm not even sure what the image it is complaining about is = or how it was added. public boolean save(Map props) { try { OPCPackage docPackage =3D OPCPackage.openOrCreate(input); //, PackageAccess.READ_WRITE =20 POIXMLProperties xmlprops =3D new = POIXMLProperties(docPackage); // CustomProperties custom =3D = xmlprops.getCustomProperties(); // CTProperties ct =3D custom.getUnderlyingProperties(); // CTProperty[] ctp =3D ct.getPropertyArray(); // // for (String key : props.keySet()) { // if (custom.contains(key)) { // for (CTProperty prop : ctp) { // //System.out.println(prop.getName() + " " + = prop.getLpwstr()); // if (prop.getName().equals(key)) { // prop.setLpwstr(props.get(key)); // } // } // } else { // custom.addProperty(key, props.get(key)); // } // // } xmlprops.commit(); File output =3D File.createTempFile("office-ooxml-",null); System.out.println(output.getCanonicalPath()); docPackage.save(output); //docPackage.flush(); return true; } catch (Exception ex) { = Logger.getLogger(OpenXMLMDWriter.class.getName()).log(Level.SEVERE, = null, ex); return false; } }= --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org