on 10-02-2013 3:05 PM
Im trying to create a excel sheet in webdynpro java using hssf api.
I am able to format the excel as per the requirement, and im facing a problem while adding a image(logo).
Iam using the following code:
FileInputStream fis=new FileInputStream("M:\\image.JPG");
ByteArrayOutputStream img_bytes=new ByteArrayOutputStream();
int b;
while((b=fis.read())!=-1)
img_bytes.write(b);
fis.close();
HSSFClientAnchor anchor = new
HSSFClientAnchor(0,0,0,0,(short)col,row,(short)++col,++row);
int index=wb.addPicture(img_bytes.toByteArray(),HSSFWorkbook.PICTURE_TYPE_JPEG);
HSSFSheet sheet=wb.getSheet("test");
HSSFPatriarch patriarch=sheet.createDrawingPatriarch();
patriarch.createPicture(anchor,index);
anchor.setAnchorType(2);
wb.write(fos);
System.out.println("Writing data to the xls file");
fos.close();
System.out.println("File closed");
But doesnt work. Can anyone suggest where im going wrong?
Regards,
Padmalatha.
FileInputStream fis=new FileInputStream("M:\\image.JPG");
are you sure the path is right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.