예제 #1
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     using (writer.WriteElement("pattFill", null, "a"))
     {
         string str = "pct5";
         foreach (KeyValuePair <string, ChartFormatPatternFillStyle> pair in _hatchStyles)
         {
             if (((ChartFormatPatternFillStyle)pair.Value) == this.FillPattern)
             {
                 str = pair.Key;
                 break;
             }
         }
         writer.WriteAttributeString("prst", null, str);
         if (this.ForegroundColor != null)
         {
             using (writer.WriteElement("fgClr", null, "a"))
             {
                 ChartColorHelper.WriteColor(writer, this.ForegroundColor, this.ForegroudDrawingColorSettings);
             }
         }
         if (this.BackgroundColor != null)
         {
             using (writer.WriteElement("bgClr", null, "a"))
             {
                 ChartColorHelper.WriteColor(writer, this.BackgroundColor, this.BackgroudDrawingColorSettings);
             }
         }
     }
 }
예제 #2
0
 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);
         }
     }
 }
예제 #3
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     using (writer.WriteElement("solidFill", null, "a"))
     {
         ChartColorHelper.WriteColor(writer, this.Color, this.DrawingColorSettings);
     }
 }
예제 #4
0
 internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
 {
     foreach (XElement element in node.Elements())
     {
         if (element.Name.LocalName == "layout")
         {
             Dt.Xls.Chart.Layout layout = new Dt.Xls.Chart.Layout();
             layout.ReadXml(element, mFolder, xFile);
             this.Layout = layout;
         }
         else if (element.Name.LocalName == "numFmt")
         {
             Dt.Xls.Chart.NumberFormat format = ChartCommonSimpleNodeHelper.ReadNumberFormatNode(element);
             this.NumberFormat       = format.NumberFormatCode;
             this.NumberFormatLinked = format.LinkToSource;
         }
         else if (element.Name.LocalName == "tx")
         {
             foreach (XElement element2 in element.Elements())
             {
                 if (element2.Name.LocalName == "rich")
                 {
                     Dt.Xls.Chart.RichText text = new Dt.Xls.Chart.RichText();
                     text.ReadXml(element2, mFolder, xFile);
                     this.RichText = text;
                 }
                 else if (element2.Name.LocalName == "strRef")
                 {
                     this.TextStringReference = element2.GetChildElementValue("f");
                 }
             }
         }
     }
 }
예제 #5
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     using (writer.WriteElement("pie3DChart", null, "c"))
     {
         writer.WriteLeafElementWithAttribute("varyColors", null, "c", "val", this.VaryColors ? "1" : "0");
         if (this.ChartType == ExcelChartType.ExplodedPie)
         {
             foreach (IExcelPieSeries series in this.PieSeries)
             {
                 if (series.Explosion == 0)
                 {
                     series.Explosion = 0x19;
                 }
             }
         }
         foreach (ExcelPieSeries series2 in this.PieSeries)
         {
             series2.WriteXml(writer, mFolder, chartFile);
         }
         if (this.DataLabels != null)
         {
             (this.DataLabels as ExcelDataLabels).WriteXml(writer, mFolder, chartFile);
         }
     }
 }
예제 #6
0
파일: TextRun.cs 프로젝트: Daoting/dt
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     using (writer.WriteElement("r", null, "a"))
     {
         if ((this.FontSize.HasValue || this.Bold.HasValue) || (this.Italics.HasValue || (this.FillFormat != null)))
         {
             using (writer.WriteElement("rPr", null, "a"))
             {
                 if (this.FontSize.HasValue)
                 {
                     double num = this.FontSize.Value * 100.0;
                     writer.WriteAttributeString("sz", ((double)num).ToString((IFormatProvider)CultureInfo.InvariantCulture));
                 }
                 if (this.Bold.HasValue)
                 {
                     writer.WriteAttributeString("b", this.Bold.Value ? "1" : "0");
                 }
                 if (this.Italics.HasValue)
                 {
                     writer.WriteAttributeString("i", this.Italics.Value ? "1" : "0");
                 }
                 if (this.FillFormat != null)
                 {
                     this.FillFormat.WriteXml(writer, mFolder, chartFile);
                 }
             }
         }
         writer.WriteElementString("a", "t", null, this.Text);
     }
 }
예제 #7
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     writer.WriteStartElement("c", "dPt", null);
     writer.WriteLeafElementWithAttribute("idx", null, "c", "val", ((int)this.Index).ToString((IFormatProvider)CultureInfo.InvariantCulture));
     writer.WriteLeafElementWithAttribute("invertIfNegative", null, "c", "val", this.InvertIfNegative ? "1" : "0");
     if (!this.IsBubble3D)
     {
         writer.WriteLeafElementWithAttribute("bubble3D", null, "c", "val", "0");
     }
     if (this.PictureOptions != null)
     {
         this.PictureOptions.WriteXml(writer, mFolder, chartFile);
     }
     if (this.DataPointFormat != null)
     {
         (this.DataPointFormat as ExcelChartFormat).WriteXml(writer, mFolder, chartFile);
     }
     if (this.Explosion.HasValue)
     {
         writer.WriteLeafElementWithAttribute("explosion", null, "c", "val", ((int)this.Explosion.Value).ToString((IFormatProvider)CultureInfo.InvariantCulture));
     }
     if (this.Marker != null)
     {
         this.Marker.WriteXml(writer, mFolder, chartFile);
     }
     writer.WriteEndElement();
 }
예제 #8
0
 internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
 {
     foreach (XElement element in node.Elements())
     {
         if (element.Name.LocalName == "downBars")
         {
             foreach (XElement element2 in element.Elements())
             {
                 if (element2.Name.LocalName == "spPr")
                 {
                     ExcelChartFormat format = new ExcelChartFormat();
                     format.ReadXml(element2, mFolder, xFile);
                     this.DownBars = format;
                 }
             }
         }
         else if (element.Name.LocalName == "upBars")
         {
             foreach (XElement element3 in element.Elements())
             {
                 if (element3.Name.LocalName == "spPr")
                 {
                     ExcelChartFormat format2 = new ExcelChartFormat();
                     format2.ReadXml(element3, mFolder, xFile);
                     this.UpBars = format2;
                 }
             }
         }
         else if (element.Name.LocalName == "gapWidth")
         {
             this.GapWidth = element.GetAttributeValueOrDefaultOfInt32Type("val", 150);
         }
     }
 }
예제 #9
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     writer.WriteStartElement("c", "numLit", null);
     if (!string.IsNullOrWhiteSpace(this.FormatCode))
     {
         writer.WriteElementString("c", "formatCode", null, this.FormatCode);
     }
     else
     {
         writer.WriteElementString("c", "formatCode", null, "General");
     }
     if (this.NumberPoints.Count > 0)
     {
         using (writer.WriteElement("ptCount", null, "c"))
         {
             writer.WriteAttributeString("val", ((int)this.NumberPoints.Count).ToString((IFormatProvider)CultureInfo.InvariantCulture));
         }
         using (List <ExcelNumberPoint> .Enumerator enumerator = this.NumberPoints.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 enumerator.Current.WriteXml(writer, mFolder, chartFile);
             }
         }
     }
     writer.WriteEndElement();
 }
예제 #10
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     using (writer.WriteElement("doughnutChart", null, "c"))
     {
         writer.WriteLeafElementWithAttribute("varyColors", null, "c", "val", this.VaryColors ? "1" : "0");
         if (this.ChartType == ExcelChartType.DoughuntExploded)
         {
             foreach (IExcelPieSeries series in this.PieSeries)
             {
                 if (series.Explosion == 0)
                 {
                     series.Explosion = 0x19;
                 }
             }
         }
         foreach (ExcelPieSeries series2 in this.PieSeries)
         {
             series2.WriteXml(writer, mFolder, chartFile);
         }
         if (this.DataLabels != null)
         {
             (this.DataLabels as ExcelDataLabels).WriteXml(writer, mFolder, chartFile);
         }
         writer.WriteLeafElementWithAttribute("firstSliceAng", null, "c", "val", ((int)this.FirstSliceAngle).ToString((IFormatProvider)CultureInfo.InvariantCulture));
         writer.WriteLeafElementWithAttribute("holeSize", null, "c", "val", ((int)this.HoleSize).ToString((IFormatProvider)CultureInfo.InvariantCulture));
     }
 }
예제 #11
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     writer.WriteStartElement("c", "scaling", null);
     if (!double.IsNaN(this.LogBase))
     {
         writer.WriteLeafElementWithAttribute("logBase", null, "c", "val", ((double)this.LogBase).ToString((IFormatProvider)CultureInfo.InvariantCulture));
     }
     if (this.Orientation == AxisOrientation.MinMax)
     {
         writer.WriteLeafElementWithAttribute("orientation", null, "c", "val", "minMax");
     }
     else
     {
         writer.WriteLeafElementWithAttribute("orientation", null, "c", "val", "maxMin");
     }
     if (!double.IsNaN(this.Max))
     {
         writer.WriteLeafElementWithAttribute("max", null, "c", "val", ((double)this.Max).ToString((IFormatProvider)CultureInfo.InvariantCulture));
     }
     if (!double.IsNaN(this.Min))
     {
         writer.WriteLeafElementWithAttribute("min", null, "c", "val", ((double)this.Min).ToString((IFormatProvider)CultureInfo.InvariantCulture));
     }
     writer.WriteEndElement();
 }
예제 #12
0
        internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
        {
            foreach (XElement element in node.Elements())
            {
                if (element.Name.LocalName == "legendPos")
                {
                    switch (element.GetAttributeValueOrDefaultOfStringType("val", "r"))
                    {
                    case "r":
                        this.Position = ExcelLegendPositon.Right;
                        break;

                    case "l":
                        this.Position = ExcelLegendPositon.Left;
                        break;

                    case "t":
                        this.Position = ExcelLegendPositon.Top;
                        break;

                    case "b":
                        this.Position = ExcelLegendPositon.Bottom;
                        break;

                    case "tr":
                        this.Position = ExcelLegendPositon.TopRight;
                        break;
                    }
                }
                else if (element.Name.LocalName == "legendEntry")
                {
                    ExcelLegendEntry entry = new ExcelLegendEntry();
                    entry.ReadXml(element, mFolder, xFile);
                    this.LegendEntries.Add(entry);
                }
                else if (element.Name.LocalName == "layout")
                {
                    Dt.Xls.Chart.Layout layout = new Dt.Xls.Chart.Layout();
                    layout.ReadXml(element, mFolder, xFile);
                    this.Layout = layout;
                }
                else if (element.Name.LocalName == "overlay")
                {
                    this.Overlay = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "spPr")
                {
                    ExcelChartFormat format = new ExcelChartFormat();
                    format.ReadXml(element, mFolder, xFile);
                    this.ShapeFormat = format;
                }
                else if (element.Name.LocalName == "txPr")
                {
                    ExcelTextFormat format2 = new ExcelTextFormat();
                    format2.ReadXml(element, mFolder, xFile);
                    this.TextFormat = format2;
                }
            }
        }
예제 #13
0
        internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
        {
            foreach (XElement element in node.Elements())
            {
                if (element.Name.LocalName == "scatterStyle")
                {
                    switch (element.GetAttributeValueOrDefaultOfStringType("val", "marker"))
                    {
                    case "marker":
                        this.ChartType = ExcelChartType.Scatter;
                        break;

                    case "line":
                        this.ChartType = ExcelChartType.ScatterLines;
                        break;

                    case "lineMarker":
                        this.ChartType = ExcelChartType.ScatterLinesWithMarkers;
                        break;

                    case "smooth":
                        this.ChartType = ExcelChartType.ScatterLinesSmooth;
                        break;

                    case "smoothMarker":
                        this.ChartType = ExcelChartType.ScatterLinesSmoothWithMarkers;
                        break;
                    }
                }
                else if (element.Name.LocalName == "dLbls")
                {
                    ExcelDataLabels labels = new ExcelDataLabels();
                    labels.ReadXml(element, mFolder, xFile);
                    this.DataLabels = labels;
                }
                else if (element.Name.LocalName == "varyColors")
                {
                    this.VaryColors = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "ser")
                {
                    ExcelScatterSeries series = new ExcelScatterSeries();
                    series.ReadXml(element, mFolder, xFile);
                    this.ScatterSeries.Add(series);
                }
                else if (element.Name.LocalName == "axId")
                {
                    int num = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
                    if (!this.XAxisID.HasValue)
                    {
                        this.XAxisID = new int?(num);
                    }
                    else if (!this.YAxisID.HasValue)
                    {
                        this.YAxisID = new int?(num);
                    }
                }
            }
        }
예제 #14
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     writer.WriteStartElement("c", "ser", null);
     writer.WriteLeafElementWithAttribute("idx", null, "c", "val", ((int)this.Index).ToString((IFormatProvider)CultureInfo.InvariantCulture));
     writer.WriteLeafElementWithAttribute("order", null, "c", "val", ((int)this.Order).ToString((IFormatProvider)CultureInfo.InvariantCulture));
     if (!this.InvertIfNegative)
     {
         writer.WriteLeafElementWithAttribute("invertIfNegative", null, "c", "val", "0");
     }
     if (this.SeriesName != null)
     {
         (this.SeriesName as ExcelSeriesName).WriteXml(writer, mFolder, chartFile);
     }
     if (this.Format != null)
     {
         (this.Format as ExcelChartFormat).WriteXml(writer, mFolder, chartFile);
     }
     if (this.DataLabels != null)
     {
         (this.DataLabels as ExcelDataLabels).WriteXml(writer, mFolder, chartFile);
     }
     if ((this.DataPoints != null) && (this.DataPoints.Count > 0))
     {
         foreach (ExcelDataPoint point in this.DataPoints)
         {
             point.WriteXml(writer, mFolder, chartFile);
         }
     }
     if (this.FirstErrorBars != null)
     {
         this.FirstErrorBars.WriteXml(writer, mFolder, chartFile);
     }
     if (this.SecondErrorBars != null)
     {
         this.SecondErrorBars.WriteXml(writer, mFolder, chartFile);
     }
     if ((this.Trendlines != null) && (this.Trendlines.Count > 0))
     {
         foreach (ExcelTrendLine line in this.Trendlines)
         {
             line.WriteXml(writer, mFolder, chartFile);
         }
     }
     if (this.CategoryAxisData != null)
     {
         (this.CategoryAxisData as ExcelCategoryAxisData).WriteXml(writer, mFolder, chartFile, "xVal");
     }
     if (this.SeriesValue != null)
     {
         (this.SeriesValue as ExcelSeriesValue).WriteXml(writer, mFolder, chartFile, "yVal");
     }
     if (this.BubbleSize != null)
     {
         (this.BubbleSize as ExcelSeriesValue).WriteXml(writer, mFolder, chartFile, "bubbleSize");
     }
     writer.WriteLeafElementWithAttribute("bubble3D", null, "c", "val", this.Bubble3D ? "1" : "0");
     writer.WriteEndElement();
 }
예제 #15
0
        internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
        {
            if ((this.AxisX == null) || (this.AxisY == null))
            {
                throw new InvalidOperationException("XAxis and YAxis cannot be null");
            }
            writer.WriteStartElement("c", "bar3DChart", null);
            writer.WriteLeafElementWithAttribute("barDir", null, "c", "val", this.GetBarDirection(this.ChartType));
            writer.WriteLeafElementWithAttribute("grouping", null, "c", "val", this.GetBarGrouping(this.ChartType));
            writer.WriteLeafElementWithAttribute("varyColors", null, "c", "val", this.VaryColors ? "1" : "0");
            foreach (ExcelBarSeries series in this.BarSeries)
            {
                series.WriteXml(writer, mFolder, chartFile);
            }
            if (this.DataLabels != null)
            {
                (this.DataLabels as ExcelDataLabels).WriteXml(writer, mFolder, chartFile);
            }
            writer.WriteLeafElementWithAttribute("gapWidth", null, "c", "val", ((int)this.GapWidth).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            writer.WriteLeafElementWithAttribute("gapDepth", null, "c", "val", ((int)this.GapDepth).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            string str  = "box";
            string str2 = this.ChartType.ToString().ToLowerInvariant();

            if (str2.StartsWith("cylinder"))
            {
                str = "cylinder";
            }
            else if (str2.StartsWith("cone"))
            {
                str = "cone";
            }
            else if (str2.StartsWith("pyramid"))
            {
                str = "pyramid";
            }
            if (!string.IsNullOrWhiteSpace(str))
            {
                writer.WriteLeafElementWithAttribute("shape", null, "c", "val", str);
            }
            if (this.AxisX != null)
            {
                writer.WriteLeafElementWithAttribute("axId", null, "c", "val", ((int)this.AxisX.Id).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            }
            if (this.AxisY != null)
            {
                writer.WriteLeafElementWithAttribute("axId", null, "c", "val", ((int)this.AxisY.Id).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            }
            if (this.AxisZ != null)
            {
                writer.WriteLeafElementWithAttribute("axId", null, "c", "val", ((int)this.AxisZ.Id).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            }
            if ((this.AxisZ == null) && !string.IsNullOrWhiteSpace(str))
            {
                writer.WriteLeafElementWithAttribute("axId", null, "c", "val", "0");
            }
            writer.WriteEndElement();
        }
예제 #16
0
 internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
 {
     foreach (XElement element in node.Elements())
     {
         if (element.Name.LocalName == "cat")
         {
             ExcelCategoryAxisData data = new ExcelCategoryAxisData();
             data.ReadXml(element);
             this.CategoryAxisData = data;
         }
         else if (element.Name.LocalName == "dLbls")
         {
             ExcelDataLabels labels = new ExcelDataLabels();
             labels.ReadXml(element, mFolder, xFile);
             this.DataLabels = labels;
         }
         else if (element.Name.LocalName == "dPt")
         {
             ExcelDataPoint point = new ExcelDataPoint();
             point.ReadXml(element, mFolder, xFile);
             this.DataPoints.Add(point);
         }
         else if (element.Name.LocalName == "idx")
         {
             this.Index = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
         }
         else if (element.Name.LocalName == "order")
         {
             this.Order = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
         }
         else if (element.Name.LocalName == "spPr")
         {
             ExcelChartFormat format = new ExcelChartFormat();
             format.ReadXml(element, mFolder, xFile);
             this.Format = format;
         }
         else if (element.Name.LocalName == "tx")
         {
             ExcelSeriesName name = new ExcelSeriesName();
             name.ReadXml(element);
             this.SeriesName = name;
         }
         else if (element.Name.LocalName == "val")
         {
             ExcelSeriesValue value2 = new ExcelSeriesValue();
             value2.ReadXml(element);
             this.SeriesValue = value2;
         }
         else if (element.Name.LocalName == "marker")
         {
             ExcelDataMarker marker = new ExcelDataMarker();
             marker.ReadXml(element, mFolder, xFile);
             this.Marker = marker;
         }
     }
 }
예제 #17
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile, string name)
 {
     using (writer.WriteElement(name, null, "c"))
     {
         if (this.Format != null)
         {
             (this.Format as ExcelChartFormat).WriteXml(writer, mFolder, chartFile);
         }
     }
 }
예제 #18
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     using (writer.WriteElement("layout", null, "c"))
     {
         if (this.ManualLayout != null)
         {
             this.ManualLayout.WriteXml(writer, mFolder, chartFile);
         }
     }
 }
예제 #19
0
 internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
 {
     foreach (XElement element in node.Elements())
     {
         if (element.Name.LocalName == "spPr")
         {
             this.Format = new ExcelChartFormat();
             (this.Format as ExcelChartFormat).ReadXml(element, mFolder, xFile);
         }
     }
 }
예제 #20
0
        internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
        {
            using (writer.WriteElement("legend", null, "c"))
            {
                string str = "r";
                switch (this.Position)
                {
                case ExcelLegendPositon.Left:
                    str = "l";
                    break;

                case ExcelLegendPositon.Top:
                    str = "t";
                    break;

                case ExcelLegendPositon.Bottom:
                    str = "b";
                    break;

                case ExcelLegendPositon.TopRight:
                    str = "tr";
                    break;

                default:
                    str = "r";
                    break;
                }
                writer.WriteLeafElementWithAttribute("legendPos", null, "c", "val", str);
                if ((this.LegendEntries != null) && (this.LegendEntries.Count > 0))
                {
                    using (List <IExcelLegendEntry> .Enumerator enumerator = this.LegendEntries.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            (enumerator.Current as ExcelLegendEntry).WriteXml(writer, mFolder, chartFile);
                        }
                    }
                }
                if (this.Layout != null)
                {
                    this.Layout.WriteXml(writer, mFolder, chartFile);
                }
                writer.WriteLeafElementWithAttribute("overlay", null, "c", "val", this.Overlay ? "1" : "0");
                if (this.ShapeFormat != null)
                {
                    (this.ShapeFormat as ExcelChartFormat).WriteXml(writer, mFolder, chartFile);
                }
                if (this.TextFormat != null)
                {
                    (this.TextFormat as ExcelTextFormat).WriteXml(writer, mFolder, chartFile);
                }
            }
        }
예제 #21
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     using (writer.WriteElement("gs", null, "a"))
     {
         double num = Math.Round(this.Position, 5) * 100000.0;
         writer.WriteAttributeString("pos", ((double)num).ToString((IFormatProvider)CultureInfo.InvariantCulture));
         if (this.Color != null)
         {
             ChartColorHelper.WriteColor(writer, this.Color, this.DrawingColorSettings);
         }
     }
 }
예제 #22
0
파일: LineEndStyle.cs 프로젝트: Daoting/dt
        internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
        {
            switch (this.Type)
            {
            case LineEndType.Traingle:
                writer.WriteAttributeString("type", "triangle");
                break;

            case LineEndType.ArrowHead:
                writer.WriteAttributeString("type", "arrow");
                break;

            case LineEndType.StealthArrow:
                writer.WriteAttributeString("type", "stealth");
                break;

            case LineEndType.Diamond:
                writer.WriteAttributeString("type", "diamond");
                break;

            case LineEndType.Oval:
                writer.WriteAttributeString("type", "oval");
                break;
            }
            switch (this.Width)
            {
            case LineSize.Large:
                writer.WriteAttributeString("w", "lg");
                break;

            case LineSize.Medium:
                writer.WriteAttributeString("w", "med");
                break;

            case LineSize.Small:
                writer.WriteAttributeString("w", "sm");
                break;
            }
            switch (this.Length)
            {
            case LineSize.Large:
                writer.WriteAttributeString("len", "lg");
                return;

            case LineSize.Medium:
                writer.WriteAttributeString("len", "med");
                return;

            case LineSize.Small:
                writer.WriteAttributeString("len", "sm");
                return;
            }
        }
예제 #23
0
 internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
 {
     foreach (XElement element in node.Elements())
     {
         if (element.Name.LocalName == "manualLayout")
         {
             ExcelManualLayout layout = new ExcelManualLayout();
             layout.ReadXml(element);
             this.ManualLayout = layout;
         }
     }
 }
예제 #24
0
 internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
 {
     foreach (XElement element in node.Elements())
     {
         if (element.Name.LocalName == "grouping")
         {
             this.ChartType = this.GetChartType(element.GetAttributeValueOrDefaultOfStringType("val", "standard"));
         }
         else if (element.Name.LocalName == "dLbls")
         {
             ExcelDataLabels labels = new ExcelDataLabels();
             labels.ReadXml(element, mFolder, xFile);
             this.DataLabels = labels;
         }
         else if (element.Name.LocalName == "varyColors")
         {
             this.VaryColors = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
         }
         else if (element.Name.LocalName == "ser")
         {
             ExcelAreaSeries series = new ExcelAreaSeries();
             series.ReadXml(element, mFolder, xFile);
             this.AreaSeries.Add(series);
         }
         else if (element.Name.LocalName == "gapDepth")
         {
             this.GapDepth = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
         }
         else if (element.Name.LocalName == "axId")
         {
             int num = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
             if (!this.XAxisID.HasValue)
             {
                 this.XAxisID = new int?(num);
             }
             else if (!this.YAxisID.HasValue)
             {
                 this.YAxisID = new int?(num);
             }
             else if (!this.ZAxisID.HasValue)
             {
                 this.ZAxisID = new int?(num);
             }
         }
         else if (element.Name.LocalName == "dropLines")
         {
             this.DropLine = new ExcelChartLines();
             this.DropLine.ReadXml(element, mFolder, xFile);
         }
     }
 }
예제 #25
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     if (writer != null)
     {
         writer.WriteStartElement("c", "pt", null);
         writer.WriteAttributeString("idx", ((int)this.Index).ToString((IFormatProvider)CultureInfo.InvariantCulture));
         if (!string.IsNullOrWhiteSpace(this.FormatCode))
         {
             writer.WriteAttributeString("c", "formatCode", null, this.FormatCode);
         }
         writer.WriteElementString("c", "v", null, this.Value);
         writer.WriteEndElement();
     }
 }
예제 #26
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile, string startElement)
 {
     writer.WriteStartElement("c", startElement, null);
     if (!string.IsNullOrWhiteSpace(this.MultiLevelStringReferenceFormula))
     {
         writer.WriteStartElement("c", "multiLvlStrRef", null);
         string multiLevelStringReferenceFormula = this.MultiLevelStringReferenceFormula;
         if (ParsingContext.ReferenceStyle == ExcelReferenceStyle.R1C1)
         {
             multiLevelStringReferenceFormula = ParsingContext.ConvertR1C1FormulaToA1Formula(multiLevelStringReferenceFormula, 0, 0);
         }
         writer.WriteElementString("c", "f", null, multiLevelStringReferenceFormula);
         writer.WriteEndElement();
     }
     else if (!string.IsNullOrWhiteSpace(this.NumberReferencesFormula))
     {
         writer.WriteStartElement("c", "numRef", null);
         string numberReferencesFormula = this.NumberReferencesFormula;
         if (ParsingContext.ReferenceStyle == ExcelReferenceStyle.R1C1)
         {
             numberReferencesFormula = ParsingContext.ConvertR1C1FormulaToA1Formula(numberReferencesFormula, 0, 0);
         }
         writer.WriteElementString("c", "f", null, numberReferencesFormula);
         using (writer.WriteElement("numCache", null, "c"))
         {
             writer.WriteElementString("c", "formatCode", null, this.FormatCode);
         }
         writer.WriteEndElement();
     }
     else if (!string.IsNullOrWhiteSpace(this.StringReferencedFormula))
     {
         writer.WriteStartElement("c", "strRef", null);
         string stringReferencedFormula = this.StringReferencedFormula;
         if (ParsingContext.ReferenceStyle == ExcelReferenceStyle.R1C1)
         {
             stringReferencedFormula = ParsingContext.ConvertR1C1FormulaToA1Formula(stringReferencedFormula, 0, 0);
         }
         writer.WriteElementString("c", "f", null, stringReferencedFormula);
         writer.WriteEndElement();
     }
     else if (this.StringLiterals != null)
     {
         this.StringLiterals.WriteXml(writer, mFolder, chartFile);
     }
     else if (this.NumericLiterals != null)
     {
         this.NumericLiterals.WriteXml(writer, mFolder, chartFile);
     }
     writer.WriteEndElement();
 }
예제 #27
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     using (writer.WriteElement("spPr", null, "c"))
     {
         if (this.FillFormat != null)
         {
             this.FillFormat.WriteXml(writer, mFolder, chartFile);
         }
         if (this.LineFormat != null)
         {
             (this.LineFormat as Dt.Xls.Chart.LineFormat).WriteXml(writer, mFolder, chartFile);
         }
     }
 }
예제 #28
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     if ((this.AxisX == null) || (this.AxisY == null))
     {
         throw new InvalidOperationException("Both XAxis and YAxis cannot be null");
     }
     if ((this.ChartType == ExcelChartType.StockHighLowClose) && (this.LineSeries.Count != 3))
     {
         throw new InvalidOperationException("StockHighLowClose chart must have 3 series");
     }
     if ((this.ChartType == ExcelChartType.StockOpenHighLowClose) && (this.LineSeries.Count != 4))
     {
         throw new InvalidOperationException("StockOpenHighLowClose chart must have 4 series");
     }
     using (writer.WriteElement("stockChart", null, "c"))
     {
         using (List <IExcelLineSeries> .Enumerator enumerator = this.LineSeries.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 (enumerator.Current as ExcelLineSeries).WriteXml(writer, mFolder, chartFile);
             }
         }
         if (this.DataLabels != null)
         {
             (this.DataLabels as ExcelDataLabels).WriteXml(writer, mFolder, chartFile);
         }
         if (this.DropLine != null)
         {
             this.DropLine.WriteXml(writer, mFolder, chartFile, "dropLines");
         }
         if (this.HighLowLine != null)
         {
             this.HighLowLine.WriteXml(writer, mFolder, chartFile, "hiLowLines");
         }
         if (this.UpDownBars != null)
         {
             this.UpDownBars.WriteXml(writer, mFolder, chartFile);
         }
         if (this.AxisX != null)
         {
             writer.WriteLeafElementWithAttribute("axId", null, "c", "val", ((int)this.AxisX.Id).ToString((IFormatProvider)CultureInfo.InvariantCulture));
         }
         if (this.AxisY != null)
         {
             writer.WriteLeafElementWithAttribute("axId", null, "c", "val", ((int)this.AxisY.Id).ToString((IFormatProvider)CultureInfo.InvariantCulture));
         }
     }
 }
예제 #29
0
 internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
 {
     foreach (XElement element in node.Elements())
     {
         if (element.Name.LocalName == "wireframe")
         {
             if (element.GetAttributeValueOrDefaultOfBooleanType("val", true))
             {
                 this.ChartType = ExcelChartType.SurfaceViewedAboveWireFrame;
             }
             else
             {
                 this.ChartType = ExcelChartType.SurfaceViewedAbove;
             }
         }
         else if (element.Name.LocalName == "ser")
         {
             ExcelSurfaceSeries series = new ExcelSurfaceSeries();
             series.ReadXml(element, mFolder, xFile);
             this.SurfaceSeries.Add(series);
         }
         else if (element.Name.LocalName == "bandFmts")
         {
             foreach (XElement element2 in element.Elements())
             {
                 if (element2.Name.LocalName == "bandFmt")
                 {
                     this.BandFormats.Add((int)((int)element2.GetChildElementAttributeValueOrDefault <int>("idx", "val")));
                 }
             }
         }
         else if (element.Name.LocalName == "axId")
         {
             int num = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
             if (!this.XAxisID.HasValue)
             {
                 this.XAxisID = new int?(num);
             }
             else if (!this.YAxisID.HasValue)
             {
                 this.YAxisID = new int?(num);
             }
             else if (!this.ZAxisID.HasValue)
             {
                 this.ZAxisID = new int?(num);
             }
         }
     }
 }
예제 #30
0
 internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
 {
     using (writer.WriteElement("legendEntry", null, "c"))
     {
         writer.WriteLeafElementWithAttribute("idx", null, "c", "val", ((int)this.Index).ToString((IFormatProvider)CultureInfo.InvariantCulture));
         if (this.TextFormat != null)
         {
             (this.TextFormat as ExcelTextFormat).WriteXml(writer, mFolder, chartFile);
         }
         else
         {
             writer.WriteLeafElementWithAttribute("delete", null, "c", "val", this.Delete ? "1" : "0");
         }
     }
 }
예제 #31
0
 public static void CreateBundle(string sOutputFile, string[] sInputFiles, string sComment)
 {
     if (System.IO.File.Exists(sOutputFile))
     {
         System.IO.File.Delete(sOutputFile);
     }
     ZipArchive archive = new ZipArchive(new DiskFile(sOutputFile));
     MemoryFolder folder = new MemoryFolder();
     archive.TempFolder = folder;
     archive.BeginUpdate();
     if (!string.IsNullOrEmpty(sComment))
     {
         archive.Comment = sComment;
     }
     foreach (string str in sInputFiles)
     {
         if (System.IO.File.Exists(str))
         {
             new DiskFile(str).CopyTo(archive.RootFolder, true);
         }
     }
     archive.EndUpdate();
 }