private void ApplyStyleFont(ExcelChartStyleEntry section, int indexForColor, IDrawingStyle chartPartWithFont, int numberOfItems) { if (section.HasTextBody) { chartPartWithFont.TextBody.SetFromXml(section.DefaultTextBody.PathElement); } if (section.HasTextRun) { chartPartWithFont.Font.SetFromXml(section.DefaultTextRun.PathElement); } if (section.FontReference.HasColor) { chartPartWithFont.Font.Fill.Style = eFillStyle.SolidFill; if (section.FontReference.Color.ColorType == eDrawingColorType.ChartStyleColor) { ColorsManager.Transform(section.FontReference.Color, indexForColor == -1 ? 0 : indexForColor, numberOfItems); } chartPartWithFont.Font.Fill.SolidFill.Color.ApplyNewColor(section.FontReference.Color); } if (section.FontReference.Index != eThemeFontCollectionType.None) { chartPartWithFont.Font.LatinFont = $"+{(section.FontReference.Index == eThemeFontCollectionType.Minor ? "mn" : "mj")}-lt"; chartPartWithFont.Font.EastAsianFont = $"+{(section.FontReference.Index == eThemeFontCollectionType.Minor ? "mn" : "mj")}-ea"; chartPartWithFont.Font.ComplexFont = $"+{(section.FontReference.Index == eThemeFontCollectionType.Minor ? "mn" : "mj")}-cs"; } }
private void TransformColor(ExcelDrawingColorManager color, ExcelChartStyleColorManager templateColor, int colorIndex, int numberOfItems) { if (templateColor != null && templateColor.ColorType == eDrawingColorType.ChartStyleColor && color.ColorType == eDrawingColorType.Scheme && color.SchemeColor.Color == eSchemeColor.Style) { ColorsManager.Transform(color, templateColor.StyleColor.Index ?? colorIndex, numberOfItems); } else if (color.ColorType == eDrawingColorType.Scheme && color.SchemeColor.Color == eSchemeColor.Style) { ColorsManager.Transform(color, colorIndex, numberOfItems); } }