Exemple #1
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();
        }
Exemple #2
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();
        }
Exemple #3
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();
        }
Exemple #4
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();
        }