Thanks Yegor,
Its working great, but getting another alignment issue with this,
i used logo (image) in the excel sheet. with the auto sizing the image also
expanding and contracting according to that column data.
Can i keep the image irrespective of the column size?
Here is the code that i used to insert the image..
_______________________________________________________________________________________________________
HSSFRow headerRow = sheet.createRow((short)0);
sheet.addMergedRegion(new Region(0,(short)0,1,(short)6));
//Displaying Logo
byte[] picData = null;
File pic = new File("C:\\images\\excelLogo.jpeg");
long length = pic.length();
picData = new byte[(int) length];
FileInputStream picIn;
picIn = new FileInputStream(pic);
picIn.read(picData);
int index = workbook.addPicture(picData,
HSSFWorkbook.PICTURE_TYPE_JPEG);
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
HSSFClientAnchor anchor = new
HSSFClientAnchor(0,0,0,255,(short)0,0,(short)1,1);
HSSFSimpleShape shape = patriarch.createPicture(anchor,index);
shape.setShapeType(HSSFSimpleShape.OBJECT_TYPE_PICTURE);
_________________________________________________________________________________________________________
Please help me in this regard,
Thanks,
Vinay
On 3/21/07, Yegor Kozlov <[EMAIL PROTECTED]> wrote:
Hi,
The POI 3.0 RC1 can be downloaded from
http://people.apache.org/~nick/POI-3.0-RC1/
HSSFSheet.autoSizeColumn was added after 12-Dec-2006.
Try the latest jar.
Regards,
Yegor
VK> Hi all,
VK> I'm new to this group. I'm trying to generate MS Excel from my java
code.
VK> I'ts working great, but i have some alignment issue like the width of
the
VK> cell is not enough to fit the text.
VK> i.e the cell width is not good enough to view the text that is
displaying.
VK> I need to set the width size automatic (i.e something like AutoFit
option)
VK> i.e the cell width should be set to max length of text value in that
column.
VK> I walked through api of HSSF (poi) but i dont find any method to set
the
VK> autoSize of the Column
VK> i have latest jar of poi-bin-3.0-alpha3-20061212 (12-Dec-2006)
VK> I have seen in couple of places that new method called
"autoSizeColumn()"
VK> was added, but i don't see even in alpha build, is there any other
build
VK> lately,
VK> Please provide me the link to download the latest jar of POI.
VK> Any Suggestions will be appreciated .
VK> Looking for any kind of help, i was in little bit urgency.
VK> Thanks,
VK> Vinay
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/