You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Mark Volkmann <r....@gmail.com> on 2011/01/20 17:50:08 UTC

align and rotate text

Is there a way to rotate the text in a cell and center it vertically
within the cell?
I tried the following. The rotation worked, but the alignment was ignored.

style.setAlignment(CellStyle.ALIGN_CENTER);
style.setRotation((short) 90);

-- 
R. Mark Volkmann
Object Computing, Inc.

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


Re: align and rotate text

Posted by Mark Volkmann <r....@gmail.com>.
On Thu, Jan 20, 2011 at 11:10 AM, Nick Burch <ni...@alfresco.com> wrote:
> On Thu, 20 Jan 2011, Mark Volkmann wrote:
>>
>> style.setRotation((short) 90);
>> style.setAlignment(CellStyle.ALIGN_CENTER);
>> style.setVerticalAlignment(CellStyle.ALIGN_CENTER);
>
> I think you need the VERTICAL_ ones though, eg
> http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/CellStyle.html#VERTICAL_CENTER

That did it! Thanks!

style.setRotation((short) 90);
style.setAlignment(CellStyle.ALIGN_CENTER);
style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

-- 
R. Mark Volkmann
Object Computing, Inc.

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


Re: align and rotate text

Posted by Nick Burch <ni...@alfresco.com>.
On Thu, 20 Jan 2011, Mark Volkmann wrote:
> style.setRotation((short) 90);
> style.setAlignment(CellStyle.ALIGN_CENTER);
> style.setVerticalAlignment(CellStyle.ALIGN_CENTER);

I think you need the VERTICAL_ ones though, eg
http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/CellStyle.html#VERTICAL_CENTER

Nick

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


Re: align and rotate text

Posted by Mark Volkmann <r....@gmail.com>.
On Thu, Jan 20, 2011 at 10:55 AM, Nick Burch <ni...@alfresco.com> wrote:
> On Thu, 20 Jan 2011, Mark Volkmann wrote:
>>
>> Is there a way to rotate the text in a cell and center it vertically
>> within the cell?
>
> Try setting a vertical alignment too?

Good idea! It didn't work though. I now have this:

style.setRotation((short) 90);
style.setAlignment(CellStyle.ALIGN_CENTER);
style.setVerticalAlignment(CellStyle.ALIGN_CENTER);

-- 
R. Mark Volkmann
Object Computing, Inc.

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


Re: align and rotate text

Posted by Nick Burch <ni...@alfresco.com>.
On Thu, 20 Jan 2011, Mark Volkmann wrote:
> Is there a way to rotate the text in a cell and center it vertically
> within the cell?

Try setting a vertical alignment too?

Nick

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