Quantcast

align and rotate text

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

align and rotate text

Mark Volkmann
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: align and rotate text

Nick Burch-11
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: align and rotate text

Mark Volkmann
On Thu, Jan 20, 2011 at 10:55 AM, Nick Burch <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: align and rotate text

Nick Burch-11
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: align and rotate text

Mark Volkmann
On Thu, Jan 20, 2011 at 11:10 AM, Nick Burch <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...