Return-Path: X-Original-To: apmail-poi-dev-archive@www.apache.org Delivered-To: apmail-poi-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 079E8D2E0 for ; Sun, 12 Aug 2012 11:30:37 +0000 (UTC) Received: (qmail 10886 invoked by uid 500); 12 Aug 2012 11:30:36 -0000 Delivered-To: apmail-poi-dev-archive@poi.apache.org Received: (qmail 10675 invoked by uid 500); 12 Aug 2012 11:30:36 -0000 Mailing-List: contact dev-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Developers List" Delivered-To: mailing list dev@poi.apache.org Received: (qmail 10655 invoked by uid 99); 12 Aug 2012 11:30:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Aug 2012 11:30:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.115] (HELO eir.zones.apache.org) (140.211.11.115) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Aug 2012 11:30:33 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id 4DA0B545D; Sun, 12 Aug 2012 11:30:12 +0000 (UTC) From: bugzilla@apache.org To: dev@poi.apache.org Subject: [Bug 51455] It would be really nice to be able to set the background picture of a comment Date: Sun, 12 Aug 2012 11:30:01 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: POI X-Bugzilla-Component: HSSF X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: superrubiroyd@gmail.com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@poi.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: bug_status resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 https://issues.apache.org/bugzilla/show_bug.cgi?id=51455 Evgeniy Berlog changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Evgeniy Berlog --- This problem should be fixed in trunk. Please try with a nightly build - see download links on http://poi.apache.org/ or build yourself from SVN trunk, see http://poi.apache.org/subversion.html Here is an example of code you can use to set backgroung image of comment: public class Test { public static void main(String[] args) throws IOException { Workbook workbook = new HSSFWorkbook(); Sheet sheetA = workbook.createSheet(); int idx = loadPicture("test.png", (HSSFWorkbook) workbook); HSSFPatriarch patriarch = (HSSFPatriarch) sheetA.createDrawingPatriarch(); HSSFComment comment = patriarch.createCellComment(new HSSFClientAnchor(0,0,0,0,(short)0,0,(short)10,10)); comment.setString(new HSSFRichTextString("HSSF POI comment background image")); comment.setBackgroundImage(idx); FileOutputStream fos = new FileOutputStream("comment_backgroung_image.xls"); workbook.write(fos); fos.close(); } private static int loadPicture( String path, HSSFWorkbook wb ) throws IOException { int pictureIndex; FileInputStream fis = null; ByteArrayOutputStream bos = null; try { fis = new FileInputStream( path); bos = new ByteArrayOutputStream( ); int c; while ( (c = fis.read()) != -1) bos.write( c ); pictureIndex = wb.addPicture( bos.toByteArray(), HSSFWorkbook.PICTURE_TYPE_PNG ); } finally { if (fis != null) fis.close(); if (bos != null) bos.close(); } return pictureIndex; } } -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org For additional commands, e-mail: dev-help@poi.apache.org