Search in sources :

Example 11 with CTRPr

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr in project poi by apache.

the class XWPFRun method setEmbossed.

public void setEmbossed(boolean value) {
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTOnOff emboss = pr.isSetEmboss() ? pr.getEmboss() : pr.addNewEmboss();
    emboss.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) CTOnOff(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff)

Example 12 with CTRPr

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr in project poi by apache.

the class TestXWPFRun method testSetGetStrike.

@Test
public void testSetGetStrike() {
    CTRPr rpr = ctRun.addNewRPr();
    rpr.addNewStrike().setVal(STOnOff.TRUE);
    XWPFRun run = new XWPFRun(ctRun, irb);
    assertEquals(true, run.isStrikeThrough());
    run.setStrikeThrough(false);
    assertEquals(STOnOff.FALSE, rpr.getStrike().getVal());
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) Test(org.junit.Test)

Example 13 with CTRPr

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr in project poi by apache.

the class TestXWPFRun method testSetGetFontFamily.

@Test
public void testSetGetFontFamily() {
    CTRPr rpr = ctRun.addNewRPr();
    rpr.addNewRFonts().setAscii("Times New Roman");
    XWPFRun run = new XWPFRun(ctRun, irb);
    assertEquals("Times New Roman", run.getFontFamily());
    run.setFontFamily("Verdana");
    assertEquals("Verdana", rpr.getRFonts().getAscii());
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) Test(org.junit.Test)

Example 14 with CTRPr

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr in project poi by apache.

the class TestXWPFRun method testCTOnOff.

/*
     * bug 59208
     * Purpose: test all valid boolean-like values
     * exercise isCTOnOff(CTOnOff) through all valid permutations
     */
@Test
public void testCTOnOff() {
    CTRPr rpr = ctRun.addNewRPr();
    CTOnOff bold = rpr.addNewB();
    XWPFRun run = new XWPFRun(ctRun, irb);
    // True values: "true", "1", "on"
    bold.setVal(STOnOff.TRUE);
    assertEquals(true, run.isBold());
    bold.setVal(STOnOff.X_1);
    assertEquals(true, run.isBold());
    bold.setVal(STOnOff.ON);
    assertEquals(true, run.isBold());
    // False values: "false", "0", "off"
    bold.setVal(STOnOff.FALSE);
    assertEquals(false, run.isBold());
    bold.setVal(STOnOff.X_0);
    assertEquals(false, run.isBold());
    bold.setVal(STOnOff.OFF);
    assertEquals(false, run.isBold());
}
Also used : CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) CTOnOff(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff) Test(org.junit.Test)

Example 15 with CTRPr

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr in project Gargoyle by callakrsos.

the class KrXWPFRun method setFontFamily.

@Override
public void setFontFamily(String fontFamily) {
    CTR run = getCTR();
    CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
    CTFonts fonts = pr.isSetRFonts() ? pr.getRFonts() : pr.addNewRFonts();
    fonts.setHAnsi(fontFamily);
    fonts.setEastAsia(fontFamily);
    fonts.setAscii(fontFamily);
    super.setFontFamily(fontFamily);
}
Also used : CTR(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR) CTRPr(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr) CTFonts(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts)

Aggregations

CTRPr (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr)31 CTOnOff (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff)10 Test (org.junit.Test)9 BigInteger (java.math.BigInteger)4 CTFonts (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts)3 CTColor (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTColor)2 CTHpsMeasure (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHpsMeasure)2 CTR (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR)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 XmlString (org.apache.xmlbeans.XmlString)1 CTP (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP)1