https://issues.apache.org/bugzilla/show_bug.cgi?id=51160

--- Comment #9 from Yegor Kozlov <[email protected]> 2011-05-18 10:40:22 UTC ---
I fixed the issue with the image not visible in XSSFOuput.xlsx. As I said,
there was a bug in XSSFPicture on line 253. The fix committed in r1312341

The image in SXSSF is still vertically  stretched if you set a custom row
height. It is not a bug, rather a feature of the current implemenetation. 

See what happens:

When you create a  Drawing you delegate the call to the underlying
XSSFSheet#createDrawingPatriarch(). Then you create a picture, resize rows and
call Picture#resize(). Excel anchores shapes to cells and rows and
Picture#resize() attempts to calculate how much columns and rows the image
occupies. It asks the parent (XSSFSheet, not SXSSFSheet!) to get the height of
the first row, but XSSFSheet knows nothing about it and returns the default row
height.

To be clear, the problem is in XSSFPicture#getRowHeightInPixels(int rowIndex) :

    private float getRowHeightInPixels(int rowIndex){
        XSSFSheet sheet = (XSSFSheet)getDrawing().getParent();

        XSSFRow row = sheet.getRow(rowIndex);
        float height = row != null ?  row.getHeightInPoints() :
sheet.getDefaultRowHeightInPoints();
        return height*PIXEL_DPI/POINT_DPI;
    }


It operates with XSSF* objects while in a SXSSF context it should operate with
SXSSFSheet and SXSSFRow.

I'm not yet sure what is the best way to fix it. One approach is to create
SXSSFDrawing and SXSSFPicture. Any ideas? 

Regards,
Yegor

(In reply to comment #6)
> Created attachment 27007 [details]
> Test case for differences in image output for the formats HSSF, XSSF and SXSSF
> 
> Running the program will produce three files. The issues are:
> - In the XSSFOuput.xlsx the image is not visible
> - In both XSSF and SXSSF the first row appears larger than in HSSF (supposed 
> to
> be 2 inch high)
> - In SXSSF the image appears vertically stretched for the reasons I describe
> earlier.

-- 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to