poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51098] New: Error in calculating image width/height, if image fits into one cell
Date Thu, 21 Apr 2011 06:03:46 GMT
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


Mime
View raw message