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 46515] New: Error in adding jpg to a workbook that has a sheet with a checkbox control
Date Mon, 12 Jan 2009 21:23:31 GMT

           Summary: Error in adding jpg to a workbook that has a sheet with
                    a checkbox control
           Product: POI
           Version: 3.2-FINAL
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: laird.trimble@gmail.com
                CC: laird.trimble@gmail.com

I have a workbook with two sheets.  The first sheet has one checkbox control on
it.  The second sheet is empty.

When I use POI to add an image to the empty spreadsheet, it corrupts the
appearence of the checkbox in the first sheet.  

This behavior happens with 2.2-Final and the latest build that I could get,

The code that I use is shown below:

            FileInputStream input = new FileInputStream(new
            POIFSFileSystem fs = new POIFSFileSystem(input);
            wb = new HSSFWorkbook(fs);

            // Get structure from webservice
            String urlString = "http://urlpath/etc);
            URL structURL = new URL(urlString);
            BufferedImage bimage = ImageIO.read(structURL);

            // Convert BufferedImage to byte[]
            ByteArrayOutputStream imageBAOS = new ByteArrayOutputStream();
            ImageIO.write(bimage, "jpeg", imageBAOS);
            byte[]imageBytes = imageBAOS.toByteArray();

            // Pop structure into Structure HSSFSheet
            int pict = wb.addPicture(imageBytes,
            HSSFPatriarch patriarch =
            HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)
1, 1, (short) 10, 22);
            patriarch.createPicture(anchor, pict);

            // Write out destination file
            FileOutputStream fileOut = new FileOutputStream(destinationFile);

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

View raw message