Java Code Examples for org.docx4j.wml.RPr#setU()
The following examples show how to use
org.docx4j.wml.RPr#setU() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Docx4j_工具类_S3_Test.java From docx4j-template with Apache License 2.0 | 5 votes |
/** * @Description: 添加下划线 */ public void addRPrUnderlineStyle(RPr runProperties, UnderlineEnumeration enumType) { U val = new U(); val.setVal(enumType); runProperties.setU(val); }
Example 2
Source File: Docx4J_例子2.java From docx4j-template with Apache License 2.0 | 5 votes |
/** * 创建字体 * * @param isBlod * 粗体 * @param isUnderLine * 下划线 * @param isItalic * 斜体 * @param isStrike * 删除线 */ public RPr getRPr(ObjectFactory factory, String fontFamily, String colorVal, String fontSize, STHint sTHint, boolean isBlod, boolean isUnderLine, boolean isItalic, boolean isStrike) { RPr rPr = factory.createRPr(); RFonts rf = new RFonts(); rf.setHint(sTHint); rf.setAscii(fontFamily); rf.setHAnsi(fontFamily); rPr.setRFonts(rf); BooleanDefaultTrue bdt = factory.createBooleanDefaultTrue(); rPr.setBCs(bdt); if (isBlod) { rPr.setB(bdt); } if (isItalic) { rPr.setI(bdt); } if (isStrike) { rPr.setStrike(bdt); } if (isUnderLine) { U underline = new U(); underline.setVal(UnderlineEnumeration.SINGLE); rPr.setU(underline); } Color color = new Color(); color.setVal(colorVal); rPr.setColor(color); HpsMeasure sz = new HpsMeasure(); sz.setVal(new BigInteger(fontSize)); rPr.setSz(sz); rPr.setSzCs(sz); return rPr; }
Example 3
Source File: Docx4J_简单例子2.java From docx4j-template with Apache License 2.0 | 5 votes |
/** * 创建字体 * * @param isBlod * 粗体 * @param isUnderLine * 下划线 * @param isItalic * 斜体 * @param isStrike * 删除线 */ public RPr getRPr(ObjectFactory factory, String fontFamily, String colorVal, String fontSize, STHint sTHint, boolean isBlod, boolean isUnderLine, boolean isItalic, boolean isStrike) { RPr rPr = factory.createRPr(); RFonts rf = new RFonts(); rf.setHint(sTHint); rf.setAscii(fontFamily); rf.setHAnsi(fontFamily); rPr.setRFonts(rf); BooleanDefaultTrue bdt = factory.createBooleanDefaultTrue(); rPr.setBCs(bdt); if (isBlod) { rPr.setB(bdt); } if (isItalic) { rPr.setI(bdt); } if (isStrike) { rPr.setStrike(bdt); } if (isUnderLine) { U underline = new U(); underline.setVal(UnderlineEnumeration.SINGLE); rPr.setU(underline); } Color color = new Color(); color.setVal(colorVal); rPr.setColor(color); HpsMeasure sz = new HpsMeasure(); sz.setVal(new BigInteger(fontSize)); rPr.setSz(sz); rPr.setSzCs(sz); return rPr; }
Example 4
Source File: Docx4J_简单例子.java From docx4j-template with Apache License 2.0 | 5 votes |
/** * 创建字体 * * @param isBlod * 粗体 * @param isUnderLine * 下划线 * @param isItalic * 斜体 * @param isStrike * 删除线 */ public RPr getRPr(ObjectFactory factory, String fontFamily, String colorVal, String fontSize, STHint sTHint, boolean isBlod, boolean isUnderLine, boolean isItalic, boolean isStrike) { RPr rPr = factory.createRPr(); RFonts rf = new RFonts(); rf.setHint(sTHint); rf.setAscii(fontFamily); rf.setHAnsi(fontFamily); rPr.setRFonts(rf); BooleanDefaultTrue bdt = factory.createBooleanDefaultTrue(); rPr.setBCs(bdt); if (isBlod) { rPr.setB(bdt); } if (isItalic) { rPr.setI(bdt); } if (isStrike) { rPr.setStrike(bdt); } if (isUnderLine) { U underline = new U(); underline.setVal(UnderlineEnumeration.SINGLE); rPr.setU(underline); } Color color = new Color(); color.setVal(colorVal); rPr.setColor(color); HpsMeasure sz = new HpsMeasure(); sz.setVal(new BigInteger(fontSize)); rPr.setSz(sz); rPr.setSzCs(sz); return rPr; }
Example 5
Source File: WmlElementUtils.java From docx4j-template with Apache License 2.0 | 4 votes |
/** * @Description: 添加下划线 */ public static void addRPrUnderlineStyle(RPr runProperties, UnderlineEnumeration enumType) { U val = new U(); val.setVal(enumType); runProperties.setU(val); }
Example 6
Source File: ChangingTheStyleSheet.java From docx4j-template with Apache License 2.0 | 4 votes |
/** * Adds a single underline to the run properties. * * @param runProperties */ private static void addUnderline(RPr runProperties) { U underline = new U(); underline.setVal(UnderlineEnumeration.SINGLE); runProperties.setU(underline ); }
Example 7
Source File: Docx4j_创建批注_S3_Test.java From docx4j-template with Apache License 2.0 | 4 votes |
public RPr getRPrStyle(ObjectFactory factory, String fontFamily, String colorVal, String fontSize, STHint sTHint, boolean isBlod, boolean isItalic, boolean isStrike, boolean isUnderLine, UnderlineEnumeration underLineStyle, String underLineColor, boolean isHightLight, String hightLightValue, boolean isShd, STShd shdValue, String shdColor, CTVerticalAlignRun stRunEnum) { RPr rPr = factory.createRPr(); RFonts rf = new RFonts(); if (sTHint != null) { rf.setHint(sTHint); } if (fontFamily != null) { rf.setAscii(fontFamily); rf.setEastAsia(fontFamily); rf.setHAnsi(fontFamily); } rPr.setRFonts(rf); if (colorVal != null) { Color color = new Color(); color.setVal(colorVal); rPr.setColor(color); } if (fontSize != null) { HpsMeasure sz = new HpsMeasure(); sz.setVal(new BigInteger(fontSize)); rPr.setSz(sz); rPr.setSzCs(sz); } BooleanDefaultTrue bdt = factory.createBooleanDefaultTrue(); if (isBlod) { rPr.setB(bdt); } if (isItalic) { rPr.setI(bdt); } if (isStrike) { rPr.setStrike(bdt); } if (isUnderLine) { U underline = new U(); if (underLineStyle != null) { underline.setVal(underLineStyle); } if (underLineColor != null) { underline.setColor(underLineColor); } rPr.setU(underline); } if (isHightLight) { Highlight hight = new Highlight(); hight.setVal(hightLightValue); rPr.setHighlight(hight); } if (isShd) { CTShd shd = new CTShd(); if (shdColor != null) { shd.setColor(shdColor); } if (shdValue != null) { shd.setVal(shdValue); } rPr.setShd(shd); } if (stRunEnum != null) { rPr.setVertAlign(stRunEnum); } return rPr; }
Example 8
Source File: Docx4j_创建表格_S5_Test.java From docx4j-template with Apache License 2.0 | 4 votes |
public void addUnderlineStyle(RPr runProperties) { U val = new U(); val.setVal(UnderlineEnumeration.SINGLE); runProperties.setU(val); }
Example 9
Source File: DocxBuilder.java From TranskribusCore with GNU General Public License v3.0 | 4 votes |
public P createIt() { org.docx4j.wml.ObjectFactory wmlObjectFactory = new org.docx4j.wml.ObjectFactory(); P p = wmlObjectFactory.createP(); // Create object for pPr PPr ppr = wmlObjectFactory.createPPr(); p.setPPr(ppr); // Create object for rPr ParaRPr pararpr = wmlObjectFactory.createParaRPr(); ppr.setRPr(pararpr); // Create object for u U u = wmlObjectFactory.createU(); pararpr.setU(u); u.setVal(org.docx4j.wml.UnderlineEnumeration.SINGLE); // Create object for lang CTLanguage language = wmlObjectFactory.createCTLanguage(); pararpr.setLang(language); language.setVal( "en-AU"); // Create object for jc Jc jc = wmlObjectFactory.createJc(); ppr.setJc(jc); jc.setVal(org.docx4j.wml.JcEnumeration.CENTER); // Create object for r R r = wmlObjectFactory.createR(); p.getContent().add( r); // Create object for rPr RPr rpr = wmlObjectFactory.createRPr(); r.setRPr(rpr); // Create object for u U u2 = wmlObjectFactory.createU(); rpr.setU(u2); u2.setVal(org.docx4j.wml.UnderlineEnumeration.SINGLE); // Create object for lang CTLanguage language2 = wmlObjectFactory.createCTLanguage(); rpr.setLang(language2); language2.setVal( "en-AU"); // Create object for t (wrapped in JAXBElement) Text text = wmlObjectFactory.createText(); JAXBElement<org.docx4j.wml.Text> textWrapped = wmlObjectFactory.createRT(text); r.getContent().add( textWrapped); text.setValue( "Underlined and centred"); return p; }