it appears that XSSF does not provide getters and setters for
horizontal and vertical alignments.

you can set these properties by manipulating low-level xml beans:

// set horizontal alignment of the 1st paragraph

        XSSFTextBox t = ...;
        
t.getCTShape().getTxBody().getPArray(0).getPPr().setAlgn(STTextAlignType.R);
// R is "right"

// set vertical align to "bottom"
        t.getCTShape().getTxBody().getBodyPr().setAnchor(STTextAnchoringType.B);


Yegor

On Mon, Oct 15, 2012 at 6:43 PM, stefan.chonov <[email protected]> wrote:
> Hi!
>
> I have a rectangle shape and I would like to align the text to be on
> top-center for example. I notice there the XSSFCellStyle class contains such
> methods like setAlignment() and setVerticalAlignment() who align the text in
> the cell to be in the center for example but I can't find nothing about
> alignment text in the shape. Is there any way to align the text in a form?
>
> *XSSFCellStyle class Example:*
> XSSFCellStyle cellStyle = aWorkbook.createCellStyle();
> cellStyle.setAlignment(HorizontalAlignment.CENTER);
> cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
>
>
>
> --
> View this message in context: 
> http://apache-poi.1045710.n5.nabble.com/How-to-align-text-in-the-shape-tp5711188.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to