private void WriteWrokSheetDrawing_pic_solidFill(DrawingFill fill, XElement parentNode) { if (fill.FillStyle == ExcelDrawingFillStyle.SolidFill) { XElement solidFillNode = new XElement(XName.Get("solidFill", ExcelCommon.Schema_Drawings)); if (fill.Color != Color.FromArgb(79, 129, 189)) { string rgb = fill.Color.ToArgb().ToString("X"); if (rgb.Length > 6) rgb = rgb.Substring(2, 6); if (rgb.Length < 6) rgb = rgb.PadLeft(6, '0'); XElement srgbClrNode = new XElement(XName.Get("srgbClr", ExcelCommon.Schema_Drawings), new XAttribute(XName.Get("val"), rgb)); srgbClrNode.Add(new XElement(XName.Get("alpha", ExcelCommon.Schema_Drawings), new XAttribute(XName.Get("val"), ((100 - fill.Transparancy) * 1000).ToString()))); solidFillNode.Add(srgbClrNode); } parentNode.Add(solidFillNode); } else parentNode.Add(new XElement(XName.Get("noFill", ExcelCommon.Schema_Drawings))); }
private void ReadWrokSheetDrawings_DrawingPic_spr_fill(DrawingFill drawingFill, XElement fillElement) { XElement childNode = fillElement.Element(XName.Get("srgbClr", ExcelCommon.Schema_Drawings)); if (childNode != null) { XAttribute valXB = childNode.Attribute(XName.Get("val")); if (valXB != null) { drawingFill.Color = Color.FromArgb(int.Parse(valXB.Value, System.Globalization.NumberStyles.AllowHexSpecifier)); } XElement alphaNode = childNode.Element(XName.Get("alpha", ExcelCommon.Schema_Drawings)); if (alphaNode != null) { valXB = alphaNode.Attribute(XName.Get("val")); if (valXB != null) { drawingFill.Transparancy = 100 - (int.Parse(valXB.Value) / 1000); } } } }