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 526B621AE for ; Thu, 21 Apr 2011 06:04:27 +0000 (UTC) Received: (qmail 90708 invoked by uid 500); 21 Apr 2011 06:04:26 -0000 Delivered-To: apmail-poi-dev-archive@poi.apache.org Received: (qmail 90433 invoked by uid 500); 21 Apr 2011 06:04:14 -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 90423 invoked by uid 99); 21 Apr 2011 06:04:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2011 06:04:11 +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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2011 06:04:08 +0000 Received: from thor.apache.org (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p3L63kpt017564 for ; Thu, 21 Apr 2011 06:03:46 GMT Received: (from daemon@localhost) by thor.apache.org (8.13.8+Sun/8.13.8/Submit) id p3L63kPq017563; Thu, 21 Apr 2011 02:03:46 -0400 (EDT) Date: Thu, 21 Apr 2011 02:03:46 -0400 (EDT) From: bugzilla@apache.org To: dev@poi.apache.org Subject: DO NOT REPLY [Bug 51098] New: Error in calculating image width/height, if image fits into one cell X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: POI X-Bugzilla-Component: XSSF X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kleindienst@grid-it.at X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@poi.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=51098 Summary: Error in calculating image width/height, if image fits into one cell Product: POI Version: unspecified Platform: PC Status: NEW Severity: normal Priority: P2 Component: XSSF AssignedTo: dev@poi.apache.org ReportedBy: kleindienst@grid-it.at Created an attachment (id=26918) --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26918) Modified java file with bug fixed Overview The calculation of image width and height in the class XSSFPicture of the package org.apache.poi.xssf.usermodel has a bug: If an image fits into one cell (in the second or one of the following columns), the width calculation leads to wrong results, because cw is taken from the next column, which is not relevant in that case: double cw = getColumnWidthInPixels(col2 + 1); A quick and dirty solution would be to check, if the last column (col2) is the same as the first and calculate the dx2 accordingly: if (col2 == anchor.getCol1()) { = (int) (EMU_PER_PIXEL * scaledWidth); } Same for image height. Steps to Reproduce Just ad an image to a an XLSX which fits into one cell (using the XSSF model). Build Date & Platform poi-3.7-20101029 on Windows Attachment The java file with the corrections is attached. (However, there might be a better way to solve this.) -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- 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