Beispiel #1
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");
                 }
             }
         }
     }
 }
Beispiel #2
0
        internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
        {
            writer.WriteStartElement("c", "trendlineLbl", null);
            if (this.Layout != null)
            {
                this.Layout.WriteXml(writer, mFolder, chartFile);
            }
            if (!string.IsNullOrWhiteSpace(this.NumberFormat) || !this.NumberFormatLinked)
            {
                Dt.Xls.Chart.NumberFormat numberFormat = new Dt.Xls.Chart.NumberFormat {
                    LinkToSource     = this.NumberFormatLinked,
                    NumberFormatCode = this.NumberFormat
                };
                ChartCommonSimpleNodeHelper.WriteNummberFormatNode(writer, numberFormat);
            }
            if (this.RichText != null)
            {
                using (writer.WriteElement("tx", null, "c"))
                {
                    this.RichText.WriteXml(writer, mFolder, chartFile);
                    goto Label_00F5;
                }
            }
            if (!string.IsNullOrWhiteSpace(this.TextStringReference))
            {
                using (writer.WriteElement("tx", null, "c"))
                {
                    using (writer.WriteElement("strRef", null, "c"))
                    {
                        writer.WriteElementString("c", "f", null, this.TextStringReference);
                    }
                }
            }
Label_00F5:
            writer.WriteEndElement();
        }
Beispiel #3
0
        internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
        {
            writer.WriteStartElement("c", "catAx", null);
            writer.WriteLeafElementWithAttribute("axId", null, "c", "val", ((int)this.Id).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            if (this.Scaling != null)
            {
                (this.Scaling as Dt.Xls.Chart.Scaling).WriteXml(writer, mFolder, chartFile);
            }
            if (!this.Delete)
            {
                writer.WriteLeafElementWithAttribute("delete", null, "c", "val", "0");
            }
            string str = "b";

            if (this.AxisPosition == Dt.Xls.Chart.AxisPosition.Left)
            {
                str = "l";
            }
            else if (this.AxisPosition == Dt.Xls.Chart.AxisPosition.Right)
            {
                str = "r";
            }
            else if (this.AxisPosition == Dt.Xls.Chart.AxisPosition.Top)
            {
                str = "t";
            }
            writer.WriteLeafElementWithAttribute("axPos", null, "c", "val", str);
            if (this.MajorGridlines != null)
            {
                (this.MajorGridlines as ExcelGridLine).WriteXml(writer, mFolder, chartFile, "majorGridlines");
            }
            if (this.MinorGridlines != null)
            {
                (this.MinorGridlines as ExcelGridLine).WriteXml(writer, mFolder, chartFile, "minorGridlines");
            }
            if (this.AxisTitle != null)
            {
                (this.AxisTitle as ExcelChartTitle).WriteXml(writer, mFolder, chartFile);
            }
            if (((this.NumberFormat != "General") && !string.IsNullOrWhiteSpace(this.NumberFormat)) || !this.NumberFormatLinked)
            {
                Dt.Xls.Chart.NumberFormat numberFormat = new Dt.Xls.Chart.NumberFormat {
                    LinkToSource     = this.NumberFormatLinked,
                    NumberFormatCode = this.NumberFormat
                };
                ChartCommonSimpleNodeHelper.WriteNummberFormatNode(writer, numberFormat);
            }
            writer.WriteLeafElementWithAttribute("majorTickMark", null, "c", "val", this.GetTickMarkStringForExcel(this.MajorTickMark));
            writer.WriteLeafElementWithAttribute("minorTickMark", null, "c", "val", this.GetTickMarkStringForExcel(this.MinorTickMark));
            writer.WriteLeafElementWithAttribute("tickLblPos", null, "c", "val", this.GetTickLabelPositionStringForExcel(this.TickLabelPosition));
            if (this.ShapeFormat != null)
            {
                (this.ShapeFormat as ExcelChartFormat).WriteXml(writer, mFolder, chartFile);
            }
            if (this.TextFormat != null)
            {
                (this.TextFormat as ExcelTextFormat).WriteXml(writer, mFolder, chartFile);
            }
            if (this.CrossAx != 0)
            {
                writer.WriteLeafElementWithAttribute("crossAx", null, "c", "val", ((int)this.CrossAx).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            }
            if (!double.IsNaN(this.CrosssAt))
            {
                writer.WriteLeafElementWithAttribute("crossesAt", null, "c", "val", ((double)this.CrosssAt).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            }
            else
            {
                string str2 = "autoZero";
                switch (this.Crosses)
                {
                case AxisCrosses.AutoZero:
                    str2 = "autoZero";
                    break;

                case AxisCrosses.Max:
                    str2 = "max";
                    break;

                case AxisCrosses.Min:
                    str2 = "min";
                    break;
                }
                writer.WriteLeafElementWithAttribute("crosses", null, "c", "val", str2);
            }
            writer.WriteLeafElementWithAttribute("auto", null, "c", "val", this.IsAutomaticCategoryAxis ? "1" : "0");
            string str3 = "ctr";

            switch (this.LabelAlignment)
            {
            case Dt.Xls.Chart.LabelAlignment.Center:
                str3 = "ctr";
                break;

            case Dt.Xls.Chart.LabelAlignment.Left:
                str3 = "l";
                break;

            case Dt.Xls.Chart.LabelAlignment.Right:
                str3 = "r";
                break;
            }
            writer.WriteLeafElementWithAttribute("lblAlgn", null, "c", "val", str3);
            if (this.LabelOffset != 0)
            {
                writer.WriteLeafElementWithAttribute("lblOffset", null, "c", "val", ((int)this.LabelOffset).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            }
            if (this.TickLalelInterval != 0)
            {
                writer.WriteLeafElementWithAttribute("tickLblSkip", null, "c", "val", ((int)this.TickLalelInterval).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            }
            if (this.TickMarkInterval != 0)
            {
                writer.WriteLeafElementWithAttribute("tickMarkSkip", null, "c", "val", ((int)this.TickMarkInterval).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            }
            if (!this.NoMultiLevelLables)
            {
                writer.WriteLeafElementWithAttribute("noMultiLvlLbl", null, "c", "val", "0");
            }
            writer.WriteEndElement();
        }
Beispiel #4
0
        internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
        {
            foreach (XElement element in node.Elements())
            {
                if (element.Name.LocalName == "axId")
                {
                    this.Id = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
                }
                else if (element.Name.LocalName == "scaling")
                {
                    Dt.Xls.Chart.Scaling scaling = new Dt.Xls.Chart.Scaling();
                    scaling.ReadXml(element);
                    this.Scaling = scaling;
                }
                else if (element.Name.LocalName == "delete")
                {
                    this.Delete = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "axPos")
                {
                    switch (element.GetAttributeValueOrDefaultOfStringType("val", null))
                    {
                    case "b":
                        this.AxisPosition = Dt.Xls.Chart.AxisPosition.Bottom;
                        break;

                    case "l":
                        this.AxisPosition = Dt.Xls.Chart.AxisPosition.Left;
                        break;

                    case "r":
                        this.AxisPosition = Dt.Xls.Chart.AxisPosition.Right;
                        break;

                    case "t":
                        this.AxisPosition = Dt.Xls.Chart.AxisPosition.Top;
                        break;
                    }
                }
                else if (element.Name.LocalName == "majorGridlines")
                {
                    ExcelGridLine line = new ExcelGridLine();
                    line.ReadXml(element, mFolder, xFile);
                    this.MajorGridlines = line;
                }
                else if (element.Name.LocalName == "minorGridlines")
                {
                    ExcelGridLine line2 = new ExcelGridLine();
                    line2.ReadXml(element, mFolder, xFile);
                    this.MinorGridlines = line2;
                }
                else if (element.Name.LocalName == "title")
                {
                    ExcelChartTitle title = new ExcelChartTitle();
                    title.ReadXml(element, mFolder, xFile);
                    this.AxisTitle = title;
                }
                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 == "majorTickMark")
                {
                    this.MajorTickMark = this.ReadTickMark(element.GetAttributeValueOrDefaultOfStringType("val", "cross"));
                }
                else if (element.Name.LocalName == "minorTickMark")
                {
                    this.MinorTickMark = this.ReadTickMark(element.GetAttributeValueOrDefaultOfStringType("val", "cross"));
                }
                else if (element.Name.LocalName == "tickLblPos")
                {
                    this.TickLabelPosition = this.ReadTickLabelPosition(element.GetAttributeValueOrDefaultOfStringType("val", "none"));
                }
                else if (element.Name.LocalName == "spPr")
                {
                    ExcelChartFormat format2 = new ExcelChartFormat();
                    format2.ReadXml(element, mFolder, xFile);
                    this.ShapeFormat = format2;
                }
                else if (element.Name.LocalName == "txPr")
                {
                    ExcelTextFormat format3 = new ExcelTextFormat();
                    format3.ReadXml(element, mFolder, xFile);
                    this.TextFormat = format3;
                }
                else if (element.Name.LocalName == "crossAx")
                {
                    this.CrossAx = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
                }
                else if (element.Name.LocalName == "crosses")
                {
                    switch (element.GetAttributeValueOrDefaultOfStringType("val", "autoZero"))
                    {
                    case "autoZero":
                        this.Crosses = AxisCrosses.AutoZero;
                        break;

                    case "max":
                        this.Crosses = AxisCrosses.Max;
                        break;

                    case "min":
                        this.Crosses = AxisCrosses.Min;
                        break;
                    }
                }
                else if (element.Name.LocalName == "crossesAt")
                {
                    this.CrosssAt = element.GetAttributeValueOrDefaultOfDoubleType("val", 0.0);
                }
                else if (element.Name.LocalName == "auto")
                {
                    this.IsAutomaticCategoryAxis = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "lblAlgn")
                {
                    switch (element.GetAttributeValueOrDefaultOfStringType("val", "ctr"))
                    {
                    case "ctr":
                        this.LabelAlignment = Dt.Xls.Chart.LabelAlignment.Center;
                        break;

                    case "l":
                        this.LabelAlignment = Dt.Xls.Chart.LabelAlignment.Left;
                        break;

                    case "r":
                        this.LabelAlignment = Dt.Xls.Chart.LabelAlignment.Right;
                        break;
                    }
                }
                else if (element.Name.LocalName == "lblOffset")
                {
                    this.LabelOffset = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
                }
                else if (element.Name.LocalName == "tickLblSkip")
                {
                    this.TickLalelInterval = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
                }
                else if (element.Name.LocalName == "tickMarkSkip")
                {
                    this.TickMarkInterval = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
                }
                else if (element.Name.LocalName == "noMultiLvlLbl")
                {
                    this.NoMultiLevelLables = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
            }
        }
Beispiel #5
0
        internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
        {
            foreach (XElement element in node.Elements())
            {
                if (element.Name.LocalName == "dLbl")
                {
                    ExcelDataLabel label = new ExcelDataLabel();
                    label.ReadXml(element, mFolder, xFile);
                    this.DataLabelList.Add(label);
                }
                else if (element.Name.LocalName == "delete")
                {
                    this.Delete = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                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 == "dLblPos")
                {
                    switch (element.GetAttributeValueOrDefaultOfStringType("val", "bestFit"))
                    {
                    case "b":
                        this.Position = DataLabelPosition.Bottom;
                        break;

                    case "bestFit":
                        this.Position = DataLabelPosition.BestFit;
                        break;

                    case "ctr":
                        this.Position = DataLabelPosition.Center;
                        break;

                    case "inBase":
                        this.Position = DataLabelPosition.InsideBase;
                        break;

                    case "inEnd":
                        this.Position = DataLabelPosition.InsideEnd;
                        break;

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

                    case "outEnd":
                        this.Position = DataLabelPosition.OutsideEnd;
                        break;

                    case "r":
                        this.Position = DataLabelPosition.Right;
                        break;

                    case "t":
                        this.Position = DataLabelPosition.Top;
                        break;
                    }
                }
                else if (element.Name.LocalName == "separator")
                {
                    this.Separator = element.Value;
                }
                else if (element.Name.LocalName == "showLegendKey")
                {
                    this.ShowLegendKey = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showVal")
                {
                    this.ShowValue = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showCatName")
                {
                    this.ShowCategoryName = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showSerName")
                {
                    this.ShowSeriesName = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showPercent")
                {
                    this.ShowPercentage = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showBubbleSize")
                {
                    this.ShowBubbleSize = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showLeaderLines")
                {
                    this.ShowLeaderLines = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "leaderLines")
                {
                    foreach (XElement element2 in element.Elements())
                    {
                        if (element2.Name.LocalName == "spPr")
                        {
                            ExcelChartFormat format2 = new ExcelChartFormat();
                            format2.ReadXml(element2, mFolder, xFile);
                            this.LeaderLineFormat = format2;
                        }
                    }
                }
                else if (element.Name.LocalName == "spPr")
                {
                    ExcelChartFormat format3 = new ExcelChartFormat();
                    format3.ReadXml(element, mFolder, xFile);
                    this.ShapeFormat = format3;
                }
                else if (element.Name.LocalName == "txPr")
                {
                    ExcelTextFormat format4 = new ExcelTextFormat();
                    format4.ReadXml(element, mFolder, xFile);
                    this.TextFormat = format4;
                }
            }
            if (!this.IsShowLeaderLinesSet)
            {
                this._showLeaderLines = false;
            }
            if (!this.IsShowLegendKeySet)
            {
                this._showLegendKey = false;
            }
            if (!this.IsShowBubbleSizeSet)
            {
                this._showBubbleSize = false;
            }
            if (!this.IsShowCategoryNameSet)
            {
                this._showCategoryName = false;
            }
            if (!this.IsShowPercentageSet)
            {
                this._showPercentage = false;
            }
            if (!this.IsShowSeriesNameSet)
            {
                this._showSeriesName = false;
            }
            if (!this.IsShowValueSet)
            {
                this._showValue = false;
            }
        }
Beispiel #6
0
        internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
        {
            writer.WriteStartElement("c", "dLbls", null);
            if ((this.DataLabelList != null) && (this.DataLabelList.Count > 0))
            {
                foreach (ExcelDataLabel label in this.DataLabelList)
                {
                    label.WriteXml(writer, mFolder, chartFile);
                }
            }
            if (this.ShapeFormat != null)
            {
                (this.ShapeFormat as ExcelChartFormat).WriteXml(writer, mFolder, chartFile);
            }
            if (this.TextFormat != null)
            {
                (this.TextFormat as ExcelTextFormat).WriteXml(writer, mFolder, chartFile);
            }
            if (!string.IsNullOrWhiteSpace(this.NumberFormat) || !this.NumberFormatLinked)
            {
                Dt.Xls.Chart.NumberFormat numberFormat = new Dt.Xls.Chart.NumberFormat {
                    LinkToSource     = this.NumberFormatLinked,
                    NumberFormatCode = this.NumberFormat
                };
                ChartCommonSimpleNodeHelper.WriteNummberFormatNode(writer, numberFormat);
            }
            string str = "bestFit";

            switch (this.Position)
            {
            case DataLabelPosition.Bottom:
                str = "b";
                break;

            case DataLabelPosition.BestFit:
                str = "bestFit";
                break;

            case DataLabelPosition.Center:
                str = "ctr";
                break;

            case DataLabelPosition.InsideBase:
                str = "inBase";
                break;

            case DataLabelPosition.InsideEnd:
                str = "inEnd";
                break;

            case DataLabelPosition.Left:
                str = "l";
                break;

            case DataLabelPosition.OutsideEnd:
                str = "outEnd";
                break;

            case DataLabelPosition.Right:
                str = "r";
                break;

            case DataLabelPosition.Top:
                str = "t";
                break;
            }
            if (this.Position != DataLabelPosition.BestFit)
            {
                writer.WriteLeafElementWithAttribute("dLblPos", null, "c", "val", str);
            }
            if (!this.Delete)
            {
                writer.WriteLeafElementWithAttribute("delete", null, "c", "val", "0");
            }
            if (this.Separator != CultureInfo.CurrentCulture.TextInfo.ListSeparator)
            {
                writer.WriteLeafElementWithAttribute("separator", null, "c", "val", this.Separator);
            }
            writer.WriteLeafElementWithAttribute("showLegendKey", null, "c", "val", this.ShowLegendKey ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showVal", null, "c", "val", this.ShowValue ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showCatName", null, "c", "val", this.ShowCategoryName ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showSerName", null, "c", "val", this.ShowSeriesName ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showPercent", null, "c", "val", this.ShowPercentage ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showBubbleSize", null, "c", "val", this.ShowBubbleSize ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showLeaderLines", null, "c", "val", this.ShowLeaderLines ? "1" : "0");
            if (this.LeaderLineFormat != null)
            {
                using (writer.WriteElement("leaderLines", null, "c"))
                {
                    (this.LeaderLineFormat as ExcelChartFormat).WriteXml(writer, mFolder, chartFile);
                }
            }
            writer.WriteEndElement();
        }
Beispiel #7
0
        internal void ReadXml(XElement node, MemoryFolder mFolder, XFile xFile)
        {
            foreach (XElement element in node.Elements())
            {
                if (element.Name.LocalName == "idx")
                {
                    this.Index = element.GetAttributeValueOrDefaultOfInt32Type("val", 0);
                }
                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 == "delete")
                {
                    this.Delete = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                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 == "dLblPos")
                {
                    switch (element.GetAttributeValueOrDefaultOfStringType("val", "bestFit"))
                    {
                    case "b":
                        this.Position = DataLabelPosition.Bottom;
                        break;

                    case "bestFit":
                        this.Position = DataLabelPosition.BestFit;
                        break;

                    case "ctr":
                        this.Position = DataLabelPosition.Center;
                        break;

                    case "inBase":
                        this.Position = DataLabelPosition.InsideBase;
                        break;

                    case "inEnd":
                        this.Position = DataLabelPosition.InsideEnd;
                        break;

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

                    case "outEnd":
                        this.Position = DataLabelPosition.OutsideEnd;
                        break;

                    case "r":
                        this.Position = DataLabelPosition.Right;
                        break;

                    case "t":
                        this.Position = DataLabelPosition.Top;
                        break;
                    }
                }
                else if (element.Name.LocalName == "separator")
                {
                    this.Separator = element.Value;
                }
                else if (element.Name.LocalName == "showLegendKey")
                {
                    this.ShowLegendKey = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showVal")
                {
                    this.ShowValue = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showCatName")
                {
                    this.ShowCategoryName = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showSerName")
                {
                    this.ShowSeriesName = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showPercent")
                {
                    this.ShowPercentage = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                else if (element.Name.LocalName == "showBubbleSize")
                {
                    this.ShowBubbleSize = element.GetAttributeValueOrDefaultOfBooleanType("val", true);
                }
                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.TextFormula = element2.GetChildElementValue("f");
                            if (ParsingContext.ReferenceStyle == ExcelReferenceStyle.R1C1)
                            {
                                this.TextFormula = ParsingContext.ConvertA1FormulaToR1C1Formula(this.TextFormula, 0, 0);
                            }
                        }
                    }
                }
                else if (element.Name.LocalName == "spPr")
                {
                    ExcelChartFormat format2 = new ExcelChartFormat();
                    format2.ReadXml(element, mFolder, xFile);
                    this.ShapeFormat = format2;
                }
                else if (element.Name.LocalName == "txPr")
                {
                    ExcelTextFormat format3 = new ExcelTextFormat();
                    format3.ReadXml(element, mFolder, xFile);
                    this.TextFormat = format3;
                }
            }
        }
Beispiel #8
0
        internal void WriteXml(XmlWriter writer, MemoryFolder mFolder, XFile chartFile)
        {
            writer.WriteStartElement("c", "dLbl", null);
            writer.WriteLeafElementWithAttribute("idx", null, "c", "val", ((int)this.Index).ToString((IFormatProvider)CultureInfo.InvariantCulture));
            if (this.Layout != null)
            {
                this.Layout.WriteXml(writer, mFolder, chartFile);
            }
            if (!string.IsNullOrWhiteSpace(this.NumberFormat) || !this.NumberFormatLinked)
            {
                Dt.Xls.Chart.NumberFormat numberFormat = new Dt.Xls.Chart.NumberFormat {
                    LinkToSource     = this.NumberFormatLinked,
                    NumberFormatCode = this.NumberFormat
                };
                ChartCommonSimpleNodeHelper.WriteNummberFormatNode(writer, numberFormat);
            }
            if (this.ShapeFormat != null)
            {
                (this.ShapeFormat as ExcelChartFormat).WriteXml(writer, mFolder, chartFile);
            }
            if (this.TextFormat != null)
            {
                (this.TextFormat as ExcelTextFormat).WriteXml(writer, mFolder, chartFile);
            }
            if (this.Position != DataLabelPosition.BestFit)
            {
                string str = "bestFit";
                switch (this.Position)
                {
                case DataLabelPosition.Bottom:
                    str = "b";
                    break;

                case DataLabelPosition.BestFit:
                    str = "bestFit";
                    break;

                case DataLabelPosition.Center:
                    str = "ctr";
                    break;

                case DataLabelPosition.InsideBase:
                    str = "inBase";
                    break;

                case DataLabelPosition.InsideEnd:
                    str = "inEnd";
                    break;

                case DataLabelPosition.Left:
                    str = "l";
                    break;

                case DataLabelPosition.OutsideEnd:
                    str = "outEnd";
                    break;

                case DataLabelPosition.Right:
                    str = "r";
                    break;

                case DataLabelPosition.Top:
                    str = "t";
                    break;
                }
                writer.WriteLeafElementWithAttribute("dLblPos", null, "c", "val", str);
            }
            if (!this.Delete)
            {
                writer.WriteLeafElementWithAttribute("delete", null, "c", "val", "0");
            }
            writer.WriteLeafElementWithAttribute("showLegendKey", null, "c", "val", this.ShowLegendKey ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showVal", null, "c", "val", this.ShowValue ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showCatName", null, "c", "val", this.ShowCategoryName ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showSerName", null, "c", "val", this.ShowSeriesName ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showPercent", null, "c", "val", this.ShowPercentage ? "1" : "0");
            writer.WriteLeafElementWithAttribute("showBubbleSize", null, "c", "val", this.ShowBubbleSize ? "1" : "0");
            if ((this.Separator != CultureInfo.CurrentCulture.TextInfo.ListSeparator) && !string.IsNullOrEmpty(this.Separator))
            {
                writer.WriteElementString("c", "separator", null, this.Separator);
            }
            if (this.RichText != null)
            {
                using (writer.WriteElement("tx", null, "c"))
                {
                    this.RichText.WriteXml(writer, mFolder, chartFile);
                    goto Label_035F;
                }
            }
            if (!string.IsNullOrWhiteSpace(this.TextFormula))
            {
                writer.WriteStartElement("c", "tx", null);
                writer.WriteStartElement("c", "strRef", null);
                string textFormula = this.TextFormula;
                if (ParsingContext.ReferenceStyle == ExcelReferenceStyle.R1C1)
                {
                    textFormula = ParsingContext.ConvertR1C1FormulaToA1Formula(textFormula, 0, 0);
                }
                writer.WriteElementString("c", "f", null, textFormula);
                writer.WriteEndElement();
                writer.WriteEndElement();
            }
Label_035F:
            writer.WriteEndElement();
        }