/** * 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) { CT_RPr pr = run.IsSetRPr() ? run.rPr : run.AddNewRPr(); CT_VerticalAlignRun ctValign = pr.IsSetVertAlign() ? pr.vertAlign : pr.AddNewVertAlign(); ctValign.val = EnumConverter.ValueOf <ST_VerticalAlignRun, VerticalAlign>(valign); }
public void TestSetGetVAlign() { CT_RPr rpr = ctRun.AddNewRPr(); rpr.AddNewVertAlign().val = (ST_VerticalAlignRun.subscript); XWPFRun run = new XWPFRun(ctRun, p); Assert.AreEqual(VerticalAlign.SUBSCRIPT, run.GetSubscript()); run.SetSubscript(VerticalAlign.BASELINE); Assert.AreEqual(ST_VerticalAlignRun.baseline, rpr.vertAlign.val); }
public void SetSubscript(VerticalAlign valign) { CT_RPr ctRpr = this.run.IsSetRPr() ? this.run.rPr : this.run.AddNewRPr(); (ctRpr.IsSetVertAlign() ? ctRpr.vertAlign : ctRpr.AddNewVertAlign()).val = EnumConverter.ValueOf <ST_VerticalAlignRun, VerticalAlign>(valign); }