You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2009/01/12 22:23:31 UTC
DO NOT REPLY [Bug 46515] New: Error in adding jpg to a workbook that
has a sheet with a checkbox control
https://issues.apache.org/bugzilla/show_bug.cgi?id=46515
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,
poi-3.5-beta4-20081217.jar.
The code that I use is shown below:
FileInputStream input = new FileInputStream(new
File(templatePath));
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);
imageBAOS.flush();
byte[]imageBytes = imageBAOS.toByteArray();
imageBAOS.close();
// Pop structure into Structure HSSFSheet
int pict = wb.addPicture(imageBytes,
HSSFWorkbook.PICTURE_TYPE_JPEG);
HSSFPatriarch patriarch =
wb.getSheet("Structure").createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)
1, 1, (short) 10, 22);
anchor.setAnchorType(2);
patriarch.createPicture(anchor, pict);
// Write out destination file
FileOutputStream fileOut = new FileOutputStream(destinationFile);
wb.write(fileOut);
fileOut.close();
--
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
DO NOT REPLY [Bug 46515] Error in adding jpg to a workbook that has
a sheet with a checkbox control
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46515
--- Comment #2 from Laird Trimble <la...@gmail.com> 2009-01-12 13:26:12 PST ---
Created an attachment (id=23107)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23107)
Output file showing error
This is the output file with the munged checkbox on the first sheet.
--
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
DO NOT REPLY [Bug 46515] Error in adding jpg to a workbook that has
a sheet with a checkbox control
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46515
--- Comment #1 from Laird Trimble <la...@gmail.com> 2009-01-12 13:24:48 PST ---
Created an attachment (id=23106)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23106)
Imput xls file
This is the input file used to demostrate this bug
--
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