Search in sources :

Example 11 with CTPPr

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();
}
Also used : CTTextAlignment(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTextAlignment) CTPPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr) CTP(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP) Test(org.junit.Test)

Aggregations

CTP (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP)11 CTPPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr)10 Test (org.junit.Test)8 BigInteger (java.math.BigInteger)3 CTOnOff (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff)2 CTR (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR)2 CTSpacing (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSpacing)2 CTLock (com.microsoft.schemas.office.office.CTLock)1 CTFormulas (com.microsoft.schemas.vml.CTFormulas)1 CTGroup (com.microsoft.schemas.vml.CTGroup)1 CTH (com.microsoft.schemas.vml.CTH)1 CTHandles (com.microsoft.schemas.vml.CTHandles)1 CTPath (com.microsoft.schemas.vml.CTPath)1 CTShape (com.microsoft.schemas.vml.CTShape)1 CTShapetype (com.microsoft.schemas.vml.CTShapetype)1 CTTextPath (com.microsoft.schemas.vml.CTTextPath)1 XWPFParagraph (org.apache.poi.xwpf.usermodel.XWPFParagraph)1 CTBorder (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder)1 CTHdrFtr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr)1 CTInd (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTInd)1