use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr in project poi by apache.
the class TestXWPFParagraph method testSetGetVerticalAlignment.
@Test
public void testSetGetVerticalAlignment() throws IOException {
//new clean instance of paragraph
XWPFDocument doc = new XWPFDocument();
XWPFParagraph p = doc.createParagraph();
CTP ctp = p.getCTP();
CTPPr ppr = ctp.getPPr() == null ? ctp.addNewPPr() : ctp.getPPr();
CTTextAlignment txtAlign = ppr.addNewTextAlignment();
txtAlign.setVal(STTextAlignment.CENTER);
assertEquals(TextAlignment.CENTER, p.getVerticalAlignment());
p.setVerticalAlignment(TextAlignment.BOTTOM);
assertEquals(STTextAlignment.BOTTOM, ppr.getTextAlignment().getVal());
doc.close();
}
Aggregations