You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by deep4u <de...@gmail.com> on 2009/07/22 13:44:01 UTC

autosize in Excel

Hello, 
        I am new to this. In my application i generate Excel Sheet using
apache poi. Its working fine. but my requirement is i set the autosize to
1st coulmn in that no need of some cells. For this how can we
implement,please share your ideas.

Regards,
Deepu
-- 
View this message in context: http://www.nabble.com/autosize-in-Excel-tp24604780p24604780.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: autosize in Excel

Posted by MSB <ma...@tiscali.co.uk>.
Just dug out the javadoc for version 3.2Final. Looking at the
HSSFClientAnchor class, I found this;

"public void setAnchorType(int anchorType)

    Sets the anchor type

    0 = Move and size with Cells, 2 = Move but don't size with cells, 3 =
Don't move or size with cells. "

Whilst the comstants were not defined in 3.2 the setAnchorType() method was.
It might be worth trying to set the type for the client anchor by passing
either 2 or 3 to the method.

Yours

Mark B


deep4u wrote:
> 
> Hello,
>         I have to use the jdk 1.4 and poi is 3.2. If i use poi 3.5 it need
> jdk 1.5 or jdk1.5+ above versions
> without changing the jdk version how to resolve it.
> 
> Thanks,
> 
> 
> MSB wrote:
>> 
>> Ah, I misunderstood your post and I guess that both of your current
>> questions really relate to the same issue; this is not a criticism, just
>> an observation by the way.
>> 
>> If that is the case, then I would still suggest updating the version of
>> POI that you are using so that you can test out the effects of the
>> HSSFCleintAnchor constants we discussed in your other post. Then, if that
>> still does not do what you want, try basing your file upon a template (a
>> spreadsheet file you have created using Excel) that already contains the
>> logo correctly positioned and aligned. Excel allows you to control images
>> more precisely than does POI; the problems really arise because images
>> float over the surface of the worksheet, they are not actually inserted
>> into a cell. Many users of the API start with a template that contains
>> macros or images for example and then use POI to build their worksheets
>> and it is a techniques that seems to work quite well. Hopefully if the
>> image already exists on the sheet then auto-sizing the column will have
>> little or no effect upon it.
>> 
>> Yours
>> 
>> Mark B
>> 
>> 
>> deep4u wrote:
>>> 
>>> Hello, 
>>>         I am new to this. In my application i generate Excel Sheet using
>>> apache poi. Its working fine. but my requirement is i set the autosize
>>> to 1st coulmn in that no need of some cells. For this how can we
>>> implement,please share your ideas.
>>> 
>>> Regards,
>>> Deepu
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/autosize-in-Excel-tp24604780p24644924.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: autosize in Excel

Posted by deep4u <de...@gmail.com>.
Hello,
        I have to use the jdk 1.4 and poi is 3.2. If i use poi 3.5 it need
jdk 1.5 or jdk1.5+ above versions
without changing the jdk version how to resolve it.

Thanks,


MSB wrote:
> 
> Ah, I misunderstood your post and I guess that both of your current
> questions really relate to the same issue; this is not a criticism, just
> an observation by the way.
> 
> If that is the case, then I would still suggest updating the version of
> POI that you are using so that you can test out the effects of the
> HSSFCleintAnchor constants we discussed in your other post. Then, if that
> still does not do what you want, try basing your file upon a template (a
> spreadsheet file you have created using Excel) that already contains the
> logo correctly positioned and aligned. Excel allows you to control images
> more precisely than does POI; the problems really arise because images
> float over the surface of the worksheet, they are not actually inserted
> into a cell. Many users of the API start with a template that contains
> macros or images for example and then use POI to build their worksheets
> and it is a techniques that seems to work quite well. Hopefully if the
> image already exists on the sheet then auto-sizing the column will have
> little or no effect upon it.
> 
> Yours
> 
> Mark B
> 
> 
> deep4u wrote:
>> 
>> Hello, 
>>         I am new to this. In my application i generate Excel Sheet using
>> apache poi. Its working fine. but my requirement is i set the autosize to
>> 1st coulmn in that no need of some cells. For this how can we
>> implement,please share your ideas.
>> 
>> Regards,
>> Deepu
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/autosize-in-Excel-tp24604780p24641384.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: autosize in Excel

Posted by MSB <ma...@tiscali.co.uk>.
Ah, I misunderstood your post and I guess that both of your current questions
really relate to the same issue; this is not a criticism, just an
observation by the way.

If that is the case, then I would still suggest updating the version of POI
that you are using so that you can test out the effects of the
HSSFCleintAnchor constants we discussed in your other post. Then, if that
still does not do what you want, try basing your file upon a template (a
spreadsheet file you have created using Excel) that already contains the
logo correctly positioned and aligned. Excel allows you to control images
more precisely than does POI; the problems really arise because images float
over the surface of the worksheet, they are not actually inserted into a
cell. Many users of the API start with a template that contains macros or
images for example and then use POI to build their worksheets and it is a
techniques that seems to work quite well. Hopefully if the image already
exists on the sheet then auto-sizing the column will have little or no
effect upon it.

Yours

Mark B


deep4u wrote:
> 
> Hello, 
>         I am new to this. In my application i generate Excel Sheet using
> apache poi. Its working fine. but my requirement is i set the autosize to
> 1st coulmn in that no need of some cells. For this how can we
> implement,please share your ideas.
> 
> Regards,
> Deepu
> 

-- 
View this message in context: http://www.nabble.com/autosize-in-Excel-tp24604780p24639392.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: autosize in Excel

Posted by deep4u <de...@gmail.com>.
Hello Mark,
               Thanks for u r reply, in my application am using Image(Logo).
i set the autosize for data, but image also expanding. How to do
irrespective of image with out autosize.

Thanks,
deepu     

MSB wrote:
> 
> I have not ried this but I do believe that it will work.
> 
> Add all of the data to your sheet with the exception of any that should
> not affect the call to the HSSFSheet.autoSizeColumn() method. Call that
> method then add the remaining data to the sheet. I believe that the data
> added after the method call will not affect the automatic resizing of the
> columns width.
> 
> It should be easy enough to check by creating cells in column one of rows
> one, three and four and then calling the autoSizeColumn() method on column
> one of the sheet. Next add data to the appropriate cell in row two and
> make sure it is larger/longer than the data in the corresponding cell in
> rows one, three and four. Save the workbook away and then open it up using
> Excel.
> 
> Yours
> 
> Mark B
> 
> 
> deep4u wrote:
>> 
>> Hello, 
>>         I am new to this. In my application i generate Excel Sheet using
>> apache poi. Its working fine. but my requirement is i set the autosize to
>> 1st coulmn in that no need of some cells. For this how can we
>> implement,please share your ideas.
>> 
>> Regards,
>> Deepu
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/autosize-in-Excel-tp24604780p24621632.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: autosize in Excel

Posted by MSB <ma...@tiscali.co.uk>.
I have not ried this but I do believe that it will work.

Add all of the data to your sheet with the exception of any that should not
affect the call to the HSSFSheet.autoSizeColumn() method. Call that method
then add the remaining data to the sheet. I believe that the data added
after the method call will not affect the automatic resizing of the columns
width.

It should be easy enough to check by creating cells in column one of rows
one, three and four and then calling the autoSizeColumn() method on column
one of the sheet. Next add data to the appropriate cell in row two and make
sure it is larger/longer than the data in the corresponding cell in rows
one, three and four. Save the workbook away and then open it up using Excel.

Yours

Mark B


deep4u wrote:
> 
> Hello, 
>         I am new to this. In my application i generate Excel Sheet using
> apache poi. Its working fine. but my requirement is i set the autosize to
> 1st coulmn in that no need of some cells. For this how can we
> implement,please share your ideas.
> 
> Regards,
> Deepu
> 

-- 
View this message in context: http://www.nabble.com/autosize-in-Excel-tp24604780p24620663.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org