Return-Path: Delivered-To: apmail-poi-user-archive@www.apache.org Received: (qmail 54962 invoked from network); 13 Apr 2011 22:14:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Apr 2011 22:14:30 -0000 Received: (qmail 23231 invoked by uid 500); 13 Apr 2011 22:14:29 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 23212 invoked by uid 500); 13 Apr 2011 22:14:29 -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 23204 invoked by uid 99); 13 Apr 2011 22:14:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Apr 2011 22:14:29 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of herve.girod@gmail.com designates 209.85.216.46 as permitted sender) Received: from [209.85.216.46] (HELO mail-qw0-f46.google.com) (209.85.216.46) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Apr 2011 22:14:23 +0000 Received: by qwk3 with SMTP id 3so814898qwk.33 for ; Wed, 13 Apr 2011 15:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=E2GkfRT6ocMiHyup5c4T/+hdoGy2iERPeDiRckfuRD4=; b=gkqBkSNd7Ewx/mfYUMnmVGiQpQriMLuFBSqmMg19CPyAykt5/KPBwfqnbpjRRJClWd HETA7YOlbt8OhYE1XftMl/fwHxqw3592pAWjiQrN7QhigLHbYco4X6+VZgokhVsIwdGs 1b8+eq7yevR4NaOkc+h1S8ENeThmWt6dd34SE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=w2kmJJWGzPXg6xysej19XaYRtwz4DvxUe+gImrFGK1mspuf55WvI6IuZVQn9xs8Rbc 9CW6zZRr/4Bpdf2d7+TP4zDaniG2+LN8IxIGvJx+HJZFytfXoQpKUKELMwHUxBuTOpX6 cOyuCUQNYJgQ3zPhetRmol0xJo1bHnmfh0f6Q= MIME-Version: 1.0 Received: by 10.229.127.81 with SMTP id f17mr4234qcs.138.1302732842687; Wed, 13 Apr 2011 15:14:02 -0700 (PDT) Received: by 10.229.231.211 with HTTP; Wed, 13 Apr 2011 15:14:02 -0700 (PDT) Date: Thu, 14 Apr 2011 00:14:02 +0200 Message-ID: Subject: Some questions for the use of HSLF API From: Herve Girod To: user@poi.apache.org Content-Type: multipart/alternative; boundary=000e0cdf9d06535d7004a0d42043 --000e0cdf9d06535d7004a0d42043 Content-Type: text/plain; charset=ISO-8859-1 Hello, I'm using the HSLF API for some time now, and it works very well, but I have some questions on some things I can't do. I do'nt know if it's because the API is (still) incomplete on some areas, or just if I'm not using it well. My questions are: - Is it possible to embed Fonts in a PowerPoint file by using the API? It's possible to do it by using an existing PowerPoint file master, but I would like to do it when I encounter a Font which does not exist in the FontCollection. For example is it possible to create a new PPFont "from scratch" using an existing TTF file, and add it to the collection? - Is it possible to group Shapes? I tried to use ShapeGroups, but the resulting PPT file still did not have groups of Shapes And finally, is it possible to add image data to the slides. I tried the following approach, but it did not work (no exception, but no image either): public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color color1, ImageObserver observer) { Rectangle rectangle = new Rectangle(sx1, sy1, sx2 - sx1, sy2 - sy1); Shape shape = trans.createTransformedShape(rectangle); Rectangle rec = shape.getBounds(); addImage(image, rec); return true; } private void addImage(Image image, Rectangle rec) { SlideShow show = slide.getSlideShow(); if (image instanceof RenderedImage) { try { byte[] b = getImageData((RenderedImage)image); int idx = show.addPicture(b, Picture.PNG); Picture pict = new Picture(idx); pict.setAnchor(rec); slide.addShape(pict); } catch (IOException e) { } } } private byte[] getImageData(RenderedImage image) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(100); ImageIO.write(image, "png", stream); stream.close(); return stream.toByteArray(); } FYI, I have developed a Graphics2D drop-in which draw in a PPT context a Swing hierarchy, and apart from these problems and other small bugs, it works well. The project is here: https://sourceforge.net/projects/j661/ Thanks!! Herve Girod --000e0cdf9d06535d7004a0d42043--