internal static void WriteXml(this IFillFormat fillFormat, XmlWriter writer, MemoryFolder mFolder, XFile chartFile) { if (fillFormat != null) { if (fillFormat is NoFillFormat) { (fillFormat as NoFillFormat).WriteXml(writer, mFolder, chartFile); } else if (fillFormat is SolidFillFormat) { (fillFormat as SolidFillFormat).WriteXml(writer, mFolder, chartFile); } else if (fillFormat is PatternFill) { (fillFormat as PatternFill).WriteXml(writer, mFolder, chartFile); } else if (fillFormat is GradientFillFormat) { (fillFormat as GradientFillFormat).WriteXml(writer, mFolder, chartFile); } else if (fillFormat is BlipFillFormat) { (fillFormat as BlipFillFormat).WriteXml(writer, mFolder, chartFile); } } }
internal static Brush GetRichTextFill(List <TextParagraph> richText, Workbook workbook) { TextRun firstRun = GetFirstRun(richText); TextParagraph firstParagraph = GetFirstParagraph(richText); Brush brush = null; IFillFormat fillFormat = null; if (firstRun != null) { fillFormat = firstRun.FillFormat; } if ((fillFormat == null) && (firstParagraph != null)) { fillFormat = firstParagraph.FillFormat; } if (fillFormat != null) { object fill = ExcelChartExtension.GetFill(fillFormat, workbook); SpreadDrawingColorSettings spreadDrawingColorSettings = ExcelChartExtension.GetSpreadDrawingColorSettings(fillFormat); if (fill is string) { if (workbook != null) { Windows.UI.Color color = Dt.Cells.Data.ColorHelper.UpdateColor(workbook.GetThemeColor((string)(fill as string)), spreadDrawingColorSettings, false); return(new SolidColorBrush(color)); } return(brush); } if (fill is Brush) { brush = fill as Brush; } } return(brush); }
internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile) { foreach (XElement element in node.Elements()) { if (element.Name.LocalName == "ln") { Dt.Xls.Chart.LineFormat format = new Dt.Xls.Chart.LineFormat(); format.ReadXml(element, mFolder, xFile); this.LineFormat = format; } IFillFormat format2 = element.ReadFillFormat(mFolder, xFile); if (format2 != null) { this.FillFormat = format2; } } }
internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile) { foreach (XElement element in node.Elements()) { if (element.Name.LocalName == "rPr") { int num = element.GetAttributeValueOrDefaultOfInt32Type("sz", -1); if ((num >= 100) && (num <= 0x61a80)) { this.FontSize = new double?(((double)num) / 100.0); } foreach (XAttribute attribute in element.Attributes()) { if (attribute.Name.LocalName == "b") { this.Bold = new bool?(element.GetAttributeValueOrDefaultOfBooleanType("b", true)); } if (attribute.Name.LocalName == "i") { this.Italics = new bool?(element.GetAttributeValueOrDefaultOfBooleanType("i", true)); } } using (IEnumerator <XElement> enumerator3 = element.Elements().GetEnumerator()) { while (enumerator3.MoveNext()) { IFillFormat format = enumerator3.Current.ReadFillFormat(mFolder, xFile); if (format != null) { this.FillFormat = format; } } continue; } } if (element.Name.LocalName == "t") { this.Text = element.Value; } } }
internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile) { int num = node.GetAttributeValueOrDefaultOfInt32Type("w", 0); this.Width = (((double)num) / 12700.0) * 1.3333333333333333; string str5 = node.GetAttributeValueOrDefaultOfStringType("cmpd", "sng"); if (str5 != null) { if (str5 == "dbl") { this.CompoundLineType = Dt.Xls.Chart.CompoundLineType.DoubleLines; } else if (str5 == "sng") { this.CompoundLineType = Dt.Xls.Chart.CompoundLineType.SingleLines; } else if (str5 == "thickThin") { this.CompoundLineType = Dt.Xls.Chart.CompoundLineType.ThickThinDoubleLines; } else if (str5 == "thinThick") { this.CompoundLineType = Dt.Xls.Chart.CompoundLineType.ThinThickDoubleLines; } else if (str5 == "tri") { this.CompoundLineType = Dt.Xls.Chart.CompoundLineType.ThinThickThinTripleLines; } } string str6 = node.GetAttributeValueOrDefaultOfStringType("cap", "sq"); if (str6 != null) { if (str6 == "flat") { this.LineEndingCap = EndLineCap.Flat; } else if (str6 == "rnd") { this.LineEndingCap = EndLineCap.Round; } else if (str6 == "sq") { this.LineEndingCap = EndLineCap.Square; } } switch (node.GetAttributeValueOrDefaultOfStringType("algn", "ctr")) { case "ctr": this.PenAlignment = Dt.Xls.Chart.PenAlignment.CenterAlignment; break; case "in": this.PenAlignment = Dt.Xls.Chart.PenAlignment.InsetAlignment; break; } foreach (XElement element in node.Elements()) { IFillFormat format = element.ReadFillFormat(mFolder, xFile); if (format != null) { this.FillFormat = format; } if (element.Name.LocalName == "headEnd") { LineEndStyle style = new LineEndStyle(); style.ReadXml(element); this.HeadLineEndStyle = style; } else if (element.Name.LocalName == "tailEnd") { LineEndStyle style2 = new LineEndStyle(); style2.ReadXml(element); this.TailLineEndStyle = style2; } else if (element.Name.LocalName == "bevel") { this.JoinType = EndLineJoinType.Bevel; } else if (element.Name.LocalName == "miter") { this.JoinType = EndLineJoinType.Miter; } else if (element.Name.LocalName == "round") { this.JoinType = EndLineJoinType.Round; } else if (element.Name.LocalName == "prstDash") { switch (element.GetAttributeValueOrDefaultOfStringType("val", "solid")) { case "dash": this.LineDashType = Dt.Xls.Chart.LineDashType.Dash; break; case "dashDot": this.LineDashType = Dt.Xls.Chart.LineDashType.DashDot; break; case "dot": this.LineDashType = Dt.Xls.Chart.LineDashType.Dot; break; case "lgDash": this.LineDashType = Dt.Xls.Chart.LineDashType.LongDash; break; case "lgDashDot": this.LineDashType = Dt.Xls.Chart.LineDashType.LongDashDot; break; case "lgDashDotDot": this.LineDashType = Dt.Xls.Chart.LineDashType.LongDashDotDot; break; case "solid": this.LineDashType = Dt.Xls.Chart.LineDashType.Solid; break; case "sysDash": this.LineDashType = Dt.Xls.Chart.LineDashType.SystemDash; break; case "sysDashDot": this.LineDashType = Dt.Xls.Chart.LineDashType.SystemDashDot; break; case "sysDashDotDot": this.LineDashType = Dt.Xls.Chart.LineDashType.SystemDashDotDot; break; case "sysDot": this.LineDashType = Dt.Xls.Chart.LineDashType.SystemDot; break; } } else { bool flag1 = element.Name.LocalName == "custDash"; } } }
internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile) { foreach (XElement element in node.Elements()) { if (element.Name.LocalName == "pPr") { foreach (XElement element2 in element.Elements()) { if (element2.Name.LocalName == "defRPr") { int num = element2.GetAttributeValueOrDefaultOfInt32Type("sz", 0); if ((num >= 100) && (num <= 0x61a80)) { this.FontSize = new double?(((double)num) / 100.0); } foreach (XAttribute attribute in element2.Attributes()) { if (attribute.Name.LocalName == "b") { this.Bold = new bool?(element2.GetAttributeValueOrDefaultOfBooleanType("b", false)); } if (attribute.Name.LocalName == "i") { this.Italics = new bool?(element2.GetAttributeValueOrDefaultOfBooleanType("i", false)); } } foreach (XElement element3 in element2.Elements()) { IFillFormat format = element3.ReadFillFormat(mFolder, xFile); if (format != null) { this.FillFormat = format; } if (element3.Name.LocalName == "latin") { this.LatinFontFamily = element3.GetAttributeValueOrDefaultOfStringType("typeface", "Microsoft YaHei"); } else if (element3.Name.LocalName == "ea") { this.EastAsianFontFamily = element3.GetAttributeValueOrDefaultOfStringType("typeface", "Microsoft YaHei"); } else if (element3.Name.LocalName == "cs") { this.ComplexFontFamily = element3.GetAttributeValueOrDefaultOfStringType("typeface", "Microsoft YaHei"); } else if (element3.Name.LocalName == "sym") { this.SymbolFontFamily = element3.GetAttributeValueOrDefaultOfStringType("typeface", "Microsoft YaHei"); } } } } } else if (element.Name.LocalName == "r") { TextRun run = new TextRun(); run.ReadXml(element, mFolder, xFile); this.TextRuns.Add(run); } } }