Пример #1
0
        private void CreateColorXml(ZipPackage p)
        {
            CreateColorPart(p);
            ColorsXml = new XmlDocument();
            ColorsXml.LoadXml(GetStartColorXml());
            ColorsXml.Save(ColorsPart.GetStream());

            ColorsManager = new ExcelChartColorsManager(NameSpaceManager, ColorsXml.DocumentElement);
        }
Пример #2
0
 internal ExcelChartStyleManager(XmlNamespaceManager nameSpaceManager, ExcelChart chart) : base(nameSpaceManager)
 {
     _chart = chart;
     LoadStyleAndColors(chart);
     if (StylePart != null)
     {
         Style = new ExcelChartStyle(nameSpaceManager, StyleXml.DocumentElement, this);
     }
     if (ColorsPart != null)
     {
         ColorsManager = new ExcelChartColorsManager(nameSpaceManager, ColorsXml.DocumentElement);
     }
     _theme = chart.WorkSheet.Workbook.ThemeManager;
 }
Пример #3
0
        /// <summary>
        /// Load a color xml documents
        /// </summary>
        /// <param name="colorXml">The color xml</param>
        public void LoadColorXml(XmlDocument colorXml)
        {
            if (colorXml == null || colorXml.DocumentElement == null || colorXml.DocumentElement.LocalName != "colorStyle" || colorXml.DocumentElement.ChildNodes.Count == 0)
            {
                throw new ArgumentException("xml", "ColorXml is null or not in the correct format");
            }

            if (ColorsPart == null)
            {
                CreateColorPart(_chart.WorkSheet.Workbook._package.Package);
            }

            ColorsXml = colorXml;
            var stream = ColorsPart.GetStream(FileMode.CreateNew);

            ColorsXml.Save(stream);

            ColorsManager = new ExcelChartColorsManager(NameSpaceManager, ColorsXml.DocumentElement);
        }