Example usage for org.apache.poi.xwpf.usermodel TextAlignment getValue

List of usage examples for org.apache.poi.xwpf.usermodel TextAlignment getValue

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.usermodel TextAlignment getValue.

Prototype

public int getValue() 

Source Link

Usage

From source file:apachepoitest.XWPFParagraphClone.java

License:Apache License

/**
 * Specifies the text vertical alignment which shall be applied to text in
 * this paragraph./*from  w w w  .j  av  a 2  s.co m*/
 * <p/>
 * If the line height (before any added spacing) is larger than one or more
 * characters on the line, all characters will be aligned to each other as
 * specified by this element.
 * </p>
 * <p/>
 * If this element is omitted on a given paragraph, its value is determined
 * by the setting previously set at any level of the style hierarchy (i.e.
 * that previous setting remains unchanged). If this setting is never
 * specified in the style hierarchy, then the vertical alignment of all
 * characters on the line shall be automatically determined by the consumer.
 * </p>
 *
 * @param valign the paragraph vertical alignment to apply to this
 *               paragraph.
 */
public void setVerticalAlignment(TextAlignment valign) {
    CTPPr pr = getCTPPr();
    CTTextAlignment textAlignment = pr.isSetTextAlignment() ? pr.getTextAlignment() : pr.addNewTextAlignment();
    STTextAlignment.Enum en = STTextAlignment.Enum.forInt(valign.getValue());
    textAlignment.setVal(en);
}