You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Yegor Kozlov <ye...@dinom.ru> on 2007/03/23 09:31:28 UTC

Re[2]: [POI- HSSF] Alignment issue in sizing the Cell automatically

VK> Can i keep the image irrespective of the column size?

No, you can't. Image anchor defines how many cells the image occupies.
If you resize columns the image gets resized too.
What POI lacks is the ability to edit anchors of existing shapes. Now you can set anchor
only when shape is constructed. In other words you can't resize images
that are already ion worksheet.

Is it possible for you to defer inserting image until all columns are
resized?

Yegor

VK> _______________________________________________________________________________________________________

VK>       HSSFRow headerRow = sheet.createRow((short)0);
VK>       sheet.addMergedRegion(new Region(0,(short)0,1,(short)6));
VK>       //Displaying Logo
VK>       byte[] picData = null;
VK>       File pic = new File("C:\\images\\excelLogo.jpeg");
VK>       long length = pic.length();
VK>       picData = new byte[(int) length];
VK>       FileInputStream picIn;
VK>       picIn = new FileInputStream(pic);
VK>       picIn.read(picData);
VK>       int index = workbook.addPicture(picData,
VK> HSSFWorkbook.PICTURE_TYPE_JPEG);

VK>       HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
VK>       HSSFClientAnchor anchor = new
VK> HSSFClientAnchor(0,0,0,255,(short)0,0,(short)1,1);
VK>       HSSFSimpleShape shape = patriarch.createPicture(anchor,index);
VK>       shape.setShapeType(HSSFSimpleShape.OBJECT_TYPE_PICTURE);

VK> _________________________________________________________________________________________________________


VK>      Please help me in this regard,

VK> Thanks,
VK> Vinay


VK> On 3/21/07, Yegor Kozlov <ye...@dinom.ru> 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: poi-user-unsubscribe@jakarta.apache.org
>> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
>> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: Re[2]: [POI- HSSF] Alignment issue in sizing the Cell automatically

Posted by Vinay Konanki <vi...@gmail.com>.
Thanks Yegor,

Ya its possible to insert after doing alignments for all columns, Its looks
better now.

-Vinay

On 3/23/07, Yegor Kozlov <ye...@dinom.ru> wrote:
>
>
> VK> Can i keep the image irrespective of the column size?
>
> No, you can't. Image anchor defines how many cells the image occupies.
> If you resize columns the image gets resized too.
> What POI lacks is the ability to edit anchors of existing shapes. Now you
> can set anchor
> only when shape is constructed. In other words you can't resize images
> that are already ion worksheet.
>
> Is it possible for you to defer inserting image until all columns are
> resized?
>
> Yegor
>
> VK>
> _______________________________________________________________________________________________________
>
> VK>       HSSFRow headerRow = sheet.createRow((short)0);
> VK>       sheet.addMergedRegion(new Region(0,(short)0,1,(short)6));
> VK>       //Displaying Logo
> VK>       byte[] picData = null;
> VK>       File pic = new File("C:\\images\\excelLogo.jpeg");
> VK>       long length = pic.length();
> VK>       picData = new byte[(int) length];
> VK>       FileInputStream picIn;
> VK>       picIn = new FileInputStream(pic);
> VK>       picIn.read(picData);
> VK>       int index = workbook.addPicture(picData,
> VK> HSSFWorkbook.PICTURE_TYPE_JPEG);
>
> VK>       HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
> VK>       HSSFClientAnchor anchor = new
> VK> HSSFClientAnchor(0,0,0,255,(short)0,0,(short)1,1);
> VK>       HSSFSimpleShape shape = patriarch.createPicture(anchor,index);
> VK>       shape.setShapeType(HSSFSimpleShape.OBJECT_TYPE_PICTURE);
>
> VK>
> _________________________________________________________________________________________________________
>
>
> VK>      Please help me in this regard,
>
> VK> Thanks,
> VK> Vinay
>
>
> VK> On 3/21/07, Yegor Kozlov <ye...@dinom.ru> 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: poi-user-unsubscribe@jakarta.apache.org
> >> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> >> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>
>