/** * Set text color. * @param rgbStr - the desired color, in the hex form "RRGGBB". */ public void SetColor(String rgbStr) { CT_RPr pr = run.IsSetRPr() ? run.rPr : run.AddNewRPr(); NPOI.OpenXmlFormats.Wordprocessing.CT_Color color = pr.IsSetColor() ? pr.color : pr.AddNewColor(); color.val = (rgbStr); }
/** * Set text color. * @param rgbStr - the desired color, in the hex form "RRGGBB". */ public void SetColor(String rgbStr) { CT_RPr pr = GetRunProperties(true); NPOI.OpenXmlFormats.Wordprocessing.CT_Color color = pr.IsSetColor() ? pr.color : pr.AddNewColor(); color.val = (rgbStr); }
/// <summary> /// 设置颜色 /// </summary> /// <param name="run"></param> /// <param name="colorType"></param> public static void SetRunColor(this XWPFRun run, ColorType colorType) { Tuple <string, string> temp = GetColor(colorType); CT_R r = run.GetCTR(); CT_RPr rpr = r.IsSetRPr() ? r.rPr : r.AddNewRPr(); CT_Color color = rpr.IsSetColor() ? rpr.color : rpr.AddNewColor(); color.val = temp.Item1; }
public string GetColor() { string str = (string)null; if (this.run.IsSetRPr()) { CT_RPr rPr = this.run.rPr; if (rPr.IsSetColor()) { str = rPr.color.val; } } return(str); }
/** * Get text color. The returned value is a string in the hex form "RRGGBB". */ public String GetColor() { String color = null; if (run.IsSetRPr()) { CT_RPr pr = run.rPr; if (pr.IsSetColor()) { NPOI.OpenXmlFormats.Wordprocessing.CT_Color clr = pr.color; color = clr.val; //clr.xgetVal().getStringValue(); } } return(color); }
public void SetColor(string rgbStr) { CT_RPr ctRpr = this.run.IsSetRPr() ? this.run.rPr : this.run.AddNewRPr(); (ctRpr.IsSetColor() ? ctRpr.color : ctRpr.AddNewColor()).val = rgbStr; }