cssStyle.addProperty("text-decoration", "line-through"); if(rPr.getVertAlign() != null) { int align = rPr.getVertAlign().getVal().intValue(); if(STVerticalAlignRun.INT_SUPERSCRIPT == align) { cssStyle.addProperty("vertical-align", "super");
cssStyle.addProperty("text-decoration", "line-through"); if(rPr.getVertAlign() != null) { int align = rPr.getVertAlign().getVal().intValue(); if(STVerticalAlignRun.INT_SUPERSCRIPT == align) { cssStyle.addProperty("vertical-align", "super");
/** * Specifies the alignment which shall be applied to the contents of this * run in relation to the default appearance of the run's text. This allows * the text to be repositioned as subscript or superscript without altering * the font size of the run properties. * <p/> * If this element is not present, the default value is to leave the * formatting applied at previous level in the style hierarchy. If this * element is never applied in the style hierarchy, then the text shall not * be subscript or superscript relative to the default baseline location for * the contents of this run. * </p> * * @param valign * @see VerticalAlign */ public void setSubscript(VerticalAlign valign) { CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr(); CTVerticalAlignRun ctValign = pr.isSetVertAlign() ? pr.getVertAlign() : pr.addNewVertAlign(); ctValign.setVal(STVerticalAlignRun.Enum.forInt(valign.getValue())); }
/** * Set the vertical alignment of the run. * * @param verticalAlignment Vertical alignment value, one of "baseline", "superscript", or "subscript". * @since 4.0.0 */ public void setVerticalAlignment(String verticalAlignment) { CTRPr pr = getRunProperties(true); CTVerticalAlignRun vertAlign = pr.isSetVertAlign() ? pr.getVertAlign() : pr.addNewVertAlign(); STVerticalAlignRun align = vertAlign.xgetVal(); if (align == null) { align = STVerticalAlignRun.Factory.newInstance(); } STVerticalAlignRun.Enum val = STVerticalAlignRun.Enum.forString(verticalAlignment); if (val != null) { align.setStringValue(val.toString()); vertAlign.xsetVal(align); } }
/** * Specifies the alignment which shall be applied to the contents of this * run in relation to the default appearance of the run's text. This allows * the text to be repositioned as subscript or superscript without altering * the font size of the run properties. * <p> * If this element is not present, the default value is to leave the * formatting applied at previous level in the style hierarchy. If this * element is never applied in the style hierarchy, then the text shall not * be subscript or superscript relative to the default baseline location for * the contents of this run. * </p> * * @param valign Type of vertical align to apply * @see VerticalAlign */ public void setSubscript(VerticalAlign valign) { CTRPr pr = getRunProperties(true); CTVerticalAlignRun ctValign = pr.isSetVertAlign() ? pr.getVertAlign() : pr.addNewVertAlign(); ctValign.setVal(STVerticalAlignRun.Enum.forInt(valign.getValue())); }
/** * Specifies the alignment which shall be applied to the contents of this * run in relation to the default appearance of the run's text. * This allows the text to be repositioned as subscript or superscript without * altering the font size of the run properties. * * @return VerticalAlign * @see {@link VerticalAlign} all possible value that could be applyed to this run * @deprecated use {@link XWPFRun.getVerticalAlignment} */ @Removal(version = "4.2") public VerticalAlign getSubscript() { CTRPr pr = getRunProperties(false); return (pr != null && pr.isSetVertAlign()) ? VerticalAlign.valueOf(pr.getVertAlign().getVal().intValue()) : VerticalAlign.BASELINE; }
/** * Specifies the alignment which shall be applied to the contents of this * run in relation to the default appearance of the run's text. * This allows the text to be repositioned as subscript or superscript without * altering the font size of the run properties. * * @return VerticalAlign * @see VerticalAlign all possible value that could be applyed to this run */ public VerticalAlign getSubscript() { CTRPr pr = run.getRPr(); return (pr != null && pr.isSetVertAlign()) ? VerticalAlign.valueOf(pr.getVertAlign().getVal().intValue()) : VerticalAlign.BASELINE; }
/** * Set the vertical alignment of the run. * * @param verticalAlignment Vertical alignment value, one of "baseline", "superscript", or "subscript". * @since 4.0.0 */ public void setVerticalAlignment(String verticalAlignment) { CTRPr pr = getRunProperties(true); CTVerticalAlignRun vertAlign = pr.isSetVertAlign() ? pr.getVertAlign() : pr.addNewVertAlign(); STVerticalAlignRun align = vertAlign.xgetVal(); if (align == null) { align = STVerticalAlignRun.Factory.newInstance(); } STVerticalAlignRun.Enum val = STVerticalAlignRun.Enum.forString(verticalAlignment); if (val != null) { align.setStringValue(val.toString()); vertAlign.xsetVal(align); } }
/** * Specifies the alignment which shall be applied to the contents of this * run in relation to the default appearance of the run's text. This allows * the text to be repositioned as subscript or superscript without altering * the font size of the run properties. * <p> * If this element is not present, the default value is to leave the * formatting applied at previous level in the style hierarchy. If this * element is never applied in the style hierarchy, then the text shall not * be subscript or superscript relative to the default baseline location for * the contents of this run. * </p> * * @param valign Type of vertical align to apply * @see VerticalAlign */ public void setSubscript(VerticalAlign valign) { CTRPr pr = getRunProperties(true); CTVerticalAlignRun ctValign = pr.isSetVertAlign() ? pr.getVertAlign() : pr.addNewVertAlign(); ctValign.setVal(STVerticalAlignRun.Enum.forInt(valign.getValue())); }
/** * Specifies the alignment which shall be applied to the contents of this * run in relation to the default appearance of the run's text. * This allows the text to be repositioned as subscript or superscript without * altering the font size of the run properties. * * @return VerticalAlign * @see {@link VerticalAlign} all possible value that could be applyed to this run * @deprecated use {@link XWPFRun.getVerticalAlignment} */ @Removal(version = "4.2") public VerticalAlign getSubscript() { CTRPr pr = getRunProperties(false); return (pr != null && pr.isSetVertAlign()) ? VerticalAlign.valueOf(pr.getVertAlign().getVal().intValue()) : VerticalAlign.BASELINE; }