use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTJc in project poi by apache.
the class TestXWPFParagraph method testSetGetAlignment.
@Test
public void testSetGetAlignment() throws IOException {
//new clean instance of paragraph
XWPFDocument doc = new XWPFDocument();
XWPFParagraph p = doc.createParagraph();
assertEquals(STJc.LEFT.intValue(), p.getAlignment().getValue());
CTP ctp = p.getCTP();
CTPPr ppr = ctp.getPPr() == null ? ctp.addNewPPr() : ctp.getPPr();
CTJc align = ppr.addNewJc();
align.setVal(STJc.CENTER);
assertEquals(ParagraphAlignment.CENTER, p.getAlignment());
p.setAlignment(ParagraphAlignment.BOTH);
assertEquals(STJc.BOTH, ppr.getJc().getVal());
doc.close();
}