/** * Specifies the font size which shall be applied to all non complex script * characters in the contents of this run.when displayed. * <p/> * If this element is not present, the default value is to leave the value * applied at previous level in the style hierarchy. If this element is * never applied in the style hierarchy, then any appropriate font size may * be used for non complex script characters. * </p> * * @param size */ public void SetFontSize(int size) { CT_RPr pr = run.IsSetRPr() ? run.rPr : run.AddNewRPr(); CT_HpsMeasure ctSize = pr.IsSetSz() ? pr.sz : pr.AddNewSz(); ctSize.val = (ulong)size * 2; }
/// <summary> /// 设置字体大小 /// </summary> /// <param name="run"></param> /// <param name="sizeType"></param> public static void SetFontSize(this XWPFRun run, FontSizeType sizeType) { ulong fontSize = GetFontSize(sizeType); CT_R r = run.GetCTR(); CT_RPr rpr = r.IsSetRPr() ? r.rPr : r.AddNewRPr(); CT_HpsMeasure ctSize = rpr.IsSetSz() ? rpr.sz : rpr.AddNewSz(); ctSize.val = fontSize; }
public int GetFontSize() { CT_RPr rPr = this.run.rPr; if (rPr == null || !rPr.IsSetSz()) { return(-1); } return((int)rPr.sz.val / 2); }
/** * Specifies the font size which shall be applied to all non complex script * characters in the contents of this run.when displayed. * * @return value representing the font size */ public int GetFontSize() { CT_RPr pr = run.rPr; return((pr != null && pr.IsSetSz()) ? (int)pr.sz.val / 2 : -1); }
public void SetFontSize(int size) { CT_RPr ctRpr = this.run.IsSetRPr() ? this.run.rPr : this.run.AddNewRPr(); (ctRpr.IsSetSz() ? ctRpr.sz : ctRpr.AddNewSz()).val = (ulong)size * 2UL; }