示例#1
0
        /// <summary>
        /// Creates ChartText which can be used to set a title on a chart.
        /// </summary>
        /// <param name="title">The text for the title</param>
        /// <returns>A <see cref="DrawingCharts.ChartText"/></returns>
        private static DrawingCharts.ChartText CreateChartText(string title)
        {
            var chartText = new DrawingCharts.ChartText();

            var richText       = new DrawingCharts.RichText();
            var bodyProperties = new Drawing.BodyProperties();
            var listStyle      = new Drawing.ListStyle();

            var paragraph = new Drawing.Paragraph();

            var paragraphProperties  = new Drawing.ParagraphProperties();
            var defaultRunProperties = new Drawing.DefaultRunProperties();

            paragraphProperties.Append(defaultRunProperties);

            var run           = new Drawing.Run();
            var runProperties = new Drawing.RunProperties()
            {
                Language = "en-US"
            };
            var text = new Drawing.Text(title);

            run.Append(runProperties);
            run.Append(text);

            paragraph.Append(paragraphProperties);
            paragraph.Append(run);

            richText.Append(bodyProperties);
            richText.Append(listStyle);
            richText.Append(paragraph);

            chartText.Append(richText);
            return(chartText);
        }
示例#2
0
        // Generates content of chartPart1.
        private void GenerateChartPart1Content(ChartPart chartPart1, Chart chart)
        {
            C.ChartSpace chartSpace1 = new C.ChartSpace();
            chartSpace1.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            chartSpace1.AddNamespaceDeclaration("c16r2", "http://schemas.microsoft.com/office/drawing/2015/06/chart");
            C.Date1904 date19041 = new C.Date1904()
            {
                Val = false
            };
            C.EditingLanguage editingLanguage1 = new C.EditingLanguage()
            {
                Val = "en-US"
            };
            C.RoundedCorners roundedCorners1 = new C.RoundedCorners()
            {
                Val = true
            };

            AlternateContent alternateContent1 = new AlternateContent();

            alternateContent1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            AlternateContentChoice alternateContentChoice1 = new AlternateContentChoice()
            {
                Requires = "c14"
            };

            alternateContentChoice1.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            C14.Style style1 = new C14.Style()
            {
                Val = 110
            };

            alternateContentChoice1.Append(style1);

            AlternateContentFallback alternateContentFallback1 = new AlternateContentFallback();

            C.Style style2 = new C.Style()
            {
                Val = 10
            };

            alternateContentFallback1.Append(style2);

            alternateContent1.Append(alternateContentChoice1);
            alternateContent1.Append(alternateContentFallback1);

            C.Chart chart1 = new C.Chart();

            C.Title title1 = new C.Title();

            C.ChartText chartText1 = new C.ChartText();

            C.RichText       richText1       = new C.RichText();
            A.BodyProperties bodyProperties1 = new A.BodyProperties();
            A.ListStyle      listStyle1      = new A.ListStyle();

            A.Paragraph paragraph1 = new A.Paragraph();

            A.ParagraphProperties  paragraphProperties1  = new A.ParagraphProperties();
            A.DefaultRunProperties defaultRunProperties1 = new A.DefaultRunProperties();

            paragraphProperties1.Append(defaultRunProperties1);

            A.Run           run1           = new A.Run();
            A.RunProperties runProperties1 = new A.RunProperties()
            {
                Language = "en-US", FontSize = 800
            };
            A.Text text1 = new A.Text();
            text1.Text = "";

            run1.Append(runProperties1);
            run1.Append(text1);

            A.Run           run2           = new A.Run();
            A.RunProperties runProperties2 = new A.RunProperties()
            {
                Language = "en-US", FontSize = 800, Baseline = 0
            };
            A.Text text2 = new A.Text();
            text2.Text = chart.Title;

            run2.Append(runProperties2);
            run2.Append(text2);
            A.EndParagraphRunProperties endParagraphRunProperties1 = new A.EndParagraphRunProperties()
            {
                Language = "en-US", FontSize = 800
            };

            paragraph1.Append(paragraphProperties1);
            paragraph1.Append(run1);
            paragraph1.Append(run2);
            paragraph1.Append(endParagraphRunProperties1);

            richText1.Append(bodyProperties1);
            richText1.Append(listStyle1);
            richText1.Append(paragraph1);

            chartText1.Append(richText1);

            C.Layout layout1 = new C.Layout();

            C.ManualLayout manualLayout1 = new C.ManualLayout();
            C.LeftMode     leftMode1     = new C.LeftMode()
            {
                Val = C.LayoutModeValues.Edge
            };
            C.TopMode topMode1 = new C.TopMode()
            {
                Val = C.LayoutModeValues.Edge
            };
            C.Left left1 = new C.Left()
            {
                Val = 0.14936699324798144D
            };
            C.Top top1 = new C.Top()
            {
                Val = 7.5867300613079197E-2D
            };

            manualLayout1.Append(leftMode1);
            manualLayout1.Append(topMode1);
            manualLayout1.Append(left1);
            manualLayout1.Append(top1);

            layout1.Append(manualLayout1);
            C.Overlay overlay1 = new C.Overlay()
            {
                Val = true
            };

            title1.Append(chartText1);
            title1.Append(layout1);
            title1.Append(overlay1);
            C.AutoTitleDeleted autoTitleDeleted1 = new C.AutoTitleDeleted()
            {
                Val = false
            };

            C.PlotArea plotArea1 = new C.PlotArea();

            C.Layout layout2 = new C.Layout();

            C.ManualLayout manualLayout2 = new C.ManualLayout();
            C.LayoutTarget layoutTarget1 = new C.LayoutTarget()
            {
                Val = C.LayoutTargetValues.Inner
            };
            C.LeftMode leftMode2 = new C.LeftMode()
            {
                Val = C.LayoutModeValues.Edge
            };
            C.TopMode topMode2 = new C.TopMode()
            {
                Val = C.LayoutModeValues.Edge
            };
            C.Left left2 = new C.Left()
            {
                Val = 0.10245464404093282D
            };
            C.Top top2 = new C.Top()
            {
                Val = 4.7416814491091287E-2D
            };
            C.Width width1 = new C.Width()
            {
                Val = 0.88919609910728359D
            };
            C.Height height1 = new C.Height()
            {
                Val = 0.86D
            };

            manualLayout2.Append(layoutTarget1);
            manualLayout2.Append(leftMode2);
            manualLayout2.Append(topMode2);
            manualLayout2.Append(left2);
            manualLayout2.Append(top2);
            manualLayout2.Append(width1);
            manualLayout2.Append(height1);

            layout2.Append(manualLayout2);

            C.AreaChart areaChart1 = new C.AreaChart();
            C.Grouping  grouping1  = new C.Grouping()
            {
                Val = C.GroupingValues.Standard
            };
            C.VaryColors varyColors1 = new C.VaryColors()
            {
                Val = true
            };

            C.AreaChartSeries areaChartSeries1 = new C.AreaChartSeries();
            C.Index           index1           = new C.Index()
            {
                Val = (UInt32Value)0U
            };
            C.Order order1 = new C.Order()
            {
                Val = (UInt32Value)0U
            };

            C.SeriesText   seriesText1   = new C.SeriesText();
            C.NumericValue numericValue1 = new C.NumericValue();
            numericValue1.Text = chart.LegendTitle;

            seriesText1.Append(numericValue1);

            C.CategoryAxisData categoryAxisData1 = new C.CategoryAxisData();

            C.NumberReference numberReference1 = new C.NumberReference();

            C.NumRefExtensionList numRefExtensionList1 = new C.NumRefExtensionList();

            C.NumRefExtension numRefExtension1 = new C.NumRefExtension()
            {
                Uri = "{02D57815-91ED-43cb-92C2-25804820EDAC}"
            };
            numRefExtension1.AddNamespaceDeclaration("c15", "http://schemas.microsoft.com/office/drawing/2012/chart");

            C15.FullReference        fullReference1        = new C15.FullReference();
            C15.SequenceOfReferences sequenceOfReferences1 = new C15.SequenceOfReferences();
            sequenceOfReferences1.Text = chart.AxisX;

            fullReference1.Append(sequenceOfReferences1);

            numRefExtension1.Append(fullReference1);

            numRefExtensionList1.Append(numRefExtension1);
            C.Formula formula1 = new C.Formula();
            formula1.Text = chart.AxisX;

            C.NumberingCache numberingCache1 = new C.NumberingCache();
            C.FormatCode     formatCode1     = new C.FormatCode();
            formatCode1.Text = "General";
            C.PointCount pointCount1 = new C.PointCount()
            {
                Val = (UInt32Value)(uint)chart.Labels.Count
            };

            numberingCache1.Append(formatCode1);
            numberingCache1.Append(pointCount1);

            for (uint i = 0; i < chart.Labels.Count; i++)
            {
                C.NumericPoint numericPoint1 = new C.NumericPoint()
                {
                    Index = (UInt32Value)i
                };
                C.NumericValue numericValue2 = new C.NumericValue();
                numericValue2.Text = chart.Labels[(int)i];

                numericPoint1.Append(numericValue2);

                numberingCache1.Append(numericPoint1);
            }

            numberReference1.Append(numRefExtensionList1);
            numberReference1.Append(formula1);
            numberReference1.Append(numberingCache1);

            categoryAxisData1.Append(numberReference1);

            C.Values values1 = new C.Values();

            C.NumberReference numberReference2 = new C.NumberReference();

            C.NumRefExtensionList numRefExtensionList2 = new C.NumRefExtensionList();

            C.NumRefExtension numRefExtension2 = new C.NumRefExtension()
            {
                Uri = "{02D57815-91ED-43cb-92C2-25804820EDAC}"
            };
            numRefExtension2.AddNamespaceDeclaration("c15", "http://schemas.microsoft.com/office/drawing/2012/chart");

            C15.FullReference        fullReference2        = new C15.FullReference();
            C15.SequenceOfReferences sequenceOfReferences2 = new C15.SequenceOfReferences();
            sequenceOfReferences2.Text = chart.AxisY;

            fullReference2.Append(sequenceOfReferences2);

            numRefExtension2.Append(fullReference2);

            numRefExtensionList2.Append(numRefExtension2);
            C.Formula formula2 = new C.Formula();
            formula2.Text = chart.AxisY;

            C.NumberingCache numberingCache2 = new C.NumberingCache();
            C.FormatCode     formatCode2     = new C.FormatCode();
            formatCode2.Text = "0.00%";
            C.PointCount pointCount2 = new C.PointCount()
            {
                Val = (UInt32Value)(uint)chart.Values.Count
            };

            numberingCache2.Append(formatCode2);
            numberingCache2.Append(pointCount2);

            for (uint i = 0; i < chart.Values.Count; i++)
            {
                C.NumericPoint numericPoint27 = new C.NumericPoint()
                {
                    Index = (UInt32Value)i
                };
                C.NumericValue numericValue28 = new C.NumericValue();
                numericValue28.Text = chart.Values[(int)i];

                numericPoint27.Append(numericValue28);

                numberingCache2.Append(numericPoint27);
            }

            numberReference2.Append(numRefExtensionList2);
            numberReference2.Append(formula2);
            numberReference2.Append(numberingCache2);

            values1.Append(numberReference2);

            C.AreaSerExtensionList areaSerExtensionList1 = new C.AreaSerExtensionList();

            C.AreaSerExtension areaSerExtension1 = new C.AreaSerExtension()
            {
                Uri = "{C3380CC4-5D6E-409C-BE32-E72D297353CC}"
            };
            areaSerExtension1.AddNamespaceDeclaration("c16", "http://schemas.microsoft.com/office/drawing/2014/chart");

            OpenXmlUnknownElement openXmlUnknownElement2 = OpenXmlUnknownElement.CreateOpenXmlUnknownElement("<c16:uniqueId val=\"{00000000-69FF-4CCD-9302-CEC5CC8046DF}\" xmlns:c16=\"http://schemas.microsoft.com/office/drawing/2014/chart\" />");

            areaSerExtension1.Append(openXmlUnknownElement2);

            areaSerExtensionList1.Append(areaSerExtension1);

            areaChartSeries1.Append(index1);
            areaChartSeries1.Append(order1);
            areaChartSeries1.Append(seriesText1);
            areaChartSeries1.Append(categoryAxisData1);
            areaChartSeries1.Append(values1);
            areaChartSeries1.Append(areaSerExtensionList1);

            C.DataLabels    dataLabels1    = new C.DataLabels();
            C.ShowLegendKey showLegendKey1 = new C.ShowLegendKey()
            {
                Val = false
            };
            C.ShowValue showValue1 = new C.ShowValue()
            {
                Val = false
            };
            C.ShowCategoryName showCategoryName1 = new C.ShowCategoryName()
            {
                Val = false
            };
            C.ShowSeriesName showSeriesName1 = new C.ShowSeriesName()
            {
                Val = false
            };
            C.ShowPercent showPercent1 = new C.ShowPercent()
            {
                Val = false
            };
            C.ShowBubbleSize showBubbleSize1 = new C.ShowBubbleSize()
            {
                Val = false
            };

            dataLabels1.Append(showLegendKey1);
            dataLabels1.Append(showValue1);
            dataLabels1.Append(showCategoryName1);
            dataLabels1.Append(showSeriesName1);
            dataLabels1.Append(showPercent1);
            dataLabels1.Append(showBubbleSize1);
            C.AxisId axisId1 = new C.AxisId()
            {
                Val = (UInt32Value)78173696U
            };
            C.AxisId axisId2 = new C.AxisId()
            {
                Val = (UInt32Value)78175232U
            };

            areaChart1.Append(grouping1);
            areaChart1.Append(varyColors1);
            areaChart1.Append(areaChartSeries1);
            areaChart1.Append(dataLabels1);
            areaChart1.Append(axisId1);
            areaChart1.Append(axisId2);

            C.CategoryAxis categoryAxis1 = new C.CategoryAxis();
            C.AxisId       axisId3       = new C.AxisId()
            {
                Val = (UInt32Value)78173696U
            };

            C.Scaling     scaling1     = new C.Scaling();
            C.Orientation orientation1 = new C.Orientation()
            {
                Val = C.OrientationValues.MinMax
            };

            scaling1.Append(orientation1);
            C.Delete delete1 = new C.Delete()
            {
                Val = true
            };
            C.AxisPosition axisPosition1 = new C.AxisPosition()
            {
                Val = C.AxisPositionValues.Bottom
            };
            C.NumberingFormat numberingFormat1 = new C.NumberingFormat()
            {
                FormatCode = "General", SourceLinked = true
            };
            C.MajorTickMark majorTickMark1 = new C.MajorTickMark()
            {
                Val = C.TickMarkValues.None
            };
            C.MinorTickMark minorTickMark1 = new C.MinorTickMark()
            {
                Val = C.TickMarkValues.Cross
            };
            C.TickLabelPosition tickLabelPosition1 = new C.TickLabelPosition()
            {
                Val = C.TickLabelPositionValues.NextTo
            };
            C.CrossingAxis crossingAxis1 = new C.CrossingAxis()
            {
                Val = (UInt32Value)78175232U
            };
            C.Crosses crosses1 = new C.Crosses()
            {
                Val = C.CrossesValues.AutoZero
            };
            C.AutoLabeled autoLabeled1 = new C.AutoLabeled()
            {
                Val = true
            };
            C.LabelAlignment labelAlignment1 = new C.LabelAlignment()
            {
                Val = C.LabelAlignmentValues.Center
            };
            C.LabelOffset labelOffset1 = new C.LabelOffset()
            {
                Val = (UInt16Value)100U
            };
            C.NoMultiLevelLabels noMultiLevelLabels1 = new C.NoMultiLevelLabels()
            {
                Val = true
            };

            categoryAxis1.Append(axisId3);
            categoryAxis1.Append(scaling1);
            categoryAxis1.Append(delete1);
            categoryAxis1.Append(axisPosition1);
            categoryAxis1.Append(numberingFormat1);
            categoryAxis1.Append(majorTickMark1);
            categoryAxis1.Append(minorTickMark1);
            categoryAxis1.Append(tickLabelPosition1);
            categoryAxis1.Append(crossingAxis1);
            categoryAxis1.Append(crosses1);
            categoryAxis1.Append(autoLabeled1);
            categoryAxis1.Append(labelAlignment1);
            categoryAxis1.Append(labelOffset1);
            categoryAxis1.Append(noMultiLevelLabels1);

            C.ValueAxis valueAxis1 = new C.ValueAxis();
            C.AxisId    axisId4    = new C.AxisId()
            {
                Val = (UInt32Value)78175232U
            };

            C.Scaling     scaling2     = new C.Scaling();
            C.Orientation orientation2 = new C.Orientation()
            {
                Val = C.OrientationValues.MinMax
            };

            scaling2.Append(orientation2);
            C.Delete delete2 = new C.Delete()
            {
                Val = true
            };
            C.AxisPosition axisPosition2 = new C.AxisPosition()
            {
                Val = C.AxisPositionValues.Left
            };
            C.MajorGridlines  majorGridlines1  = new C.MajorGridlines();
            C.NumberingFormat numberingFormat2 = new C.NumberingFormat()
            {
                FormatCode = "General", SourceLinked = true
            };
            C.MajorTickMark majorTickMark2 = new C.MajorTickMark()
            {
                Val = C.TickMarkValues.None
            };
            C.MinorTickMark minorTickMark2 = new C.MinorTickMark()
            {
                Val = C.TickMarkValues.Cross
            };
            C.TickLabelPosition tickLabelPosition2 = new C.TickLabelPosition()
            {
                Val = C.TickLabelPositionValues.NextTo
            };
            C.CrossingAxis crossingAxis2 = new C.CrossingAxis()
            {
                Val = (UInt32Value)78173696U
            };
            C.Crosses crosses2 = new C.Crosses()
            {
                Val = C.CrossesValues.AutoZero
            };
            C.CrossBetween crossBetween1 = new C.CrossBetween()
            {
                Val = C.CrossBetweenValues.MidpointCategory
            };

            valueAxis1.Append(axisId4);
            valueAxis1.Append(scaling2);
            valueAxis1.Append(delete2);
            valueAxis1.Append(axisPosition2);
            valueAxis1.Append(majorGridlines1);
            valueAxis1.Append(numberingFormat2);
            valueAxis1.Append(majorTickMark2);
            valueAxis1.Append(minorTickMark2);
            valueAxis1.Append(tickLabelPosition2);
            valueAxis1.Append(crossingAxis2);
            valueAxis1.Append(crosses2);
            valueAxis1.Append(crossBetween1);

            C.DataTable            dataTable1            = new C.DataTable();
            C.ShowHorizontalBorder showHorizontalBorder1 = new C.ShowHorizontalBorder()
            {
                Val = true
            };
            C.ShowVerticalBorder showVerticalBorder1 = new C.ShowVerticalBorder()
            {
                Val = true
            };
            C.ShowOutlineBorder showOutlineBorder1 = new C.ShowOutlineBorder()
            {
                Val = true
            };
            C.ShowKeys showKeys1 = new C.ShowKeys()
            {
                Val = true
            };

            dataTable1.Append(showHorizontalBorder1);
            dataTable1.Append(showVerticalBorder1);
            dataTable1.Append(showOutlineBorder1);
            dataTable1.Append(showKeys1);

            C.ShapeProperties shapeProperties1 = new C.ShapeProperties();

            A.Outline outline1 = new A.Outline();
            A.NoFill  noFill1  = new A.NoFill();

            outline1.Append(noFill1);

            shapeProperties1.Append(outline1);

            plotArea1.Append(layout2);
            plotArea1.Append(areaChart1);
            plotArea1.Append(categoryAxis1);
            plotArea1.Append(valueAxis1);
            plotArea1.Append(dataTable1);
            plotArea1.Append(shapeProperties1);
            C.PlotVisibleOnly plotVisibleOnly1 = new C.PlotVisibleOnly()
            {
                Val = true
            };
            C.DisplayBlanksAs displayBlanksAs1 = new C.DisplayBlanksAs()
            {
                Val = C.DisplayBlanksAsValues.Zero
            };
            C.ShowDataLabelsOverMaximum showDataLabelsOverMaximum1 = new C.ShowDataLabelsOverMaximum()
            {
                Val = true
            };

            chart1.Append(title1);
            chart1.Append(autoTitleDeleted1);
            chart1.Append(plotArea1);
            chart1.Append(plotVisibleOnly1);
            chart1.Append(displayBlanksAs1);
            chart1.Append(showDataLabelsOverMaximum1);

            C.ShapeProperties shapeProperties2 = new C.ShapeProperties();

            A.Outline outline2 = new A.Outline();
            A.NoFill  noFill2  = new A.NoFill();

            outline2.Append(noFill2);

            shapeProperties2.Append(outline2);

            C.TextProperties textProperties1 = new C.TextProperties();
            A.BodyProperties bodyProperties2 = new A.BodyProperties();
            A.ListStyle      listStyle2      = new A.ListStyle();

            A.Paragraph paragraph2 = new A.Paragraph();

            A.ParagraphProperties  paragraphProperties2  = new A.ParagraphProperties();
            A.DefaultRunProperties defaultRunProperties2 = new A.DefaultRunProperties()
            {
                FontSize = 700
            };

            paragraphProperties2.Append(defaultRunProperties2);
            A.EndParagraphRunProperties endParagraphRunProperties2 = new A.EndParagraphRunProperties()
            {
                Language = "en-US"
            };

            paragraph2.Append(paragraphProperties2);
            paragraph2.Append(endParagraphRunProperties2);

            textProperties1.Append(bodyProperties2);
            textProperties1.Append(listStyle2);
            textProperties1.Append(paragraph2);

            C.PrintSettings printSettings1 = new C.PrintSettings();
            C.HeaderFooter  headerFooter1  = new C.HeaderFooter();
            C.PageMargins   pageMargins1   = new C.PageMargins()
            {
                Left = 0.70000000000000018D, Right = 0.70000000000000018D, Top = 0.75000000000000022D, Bottom = 0.75000000000000022D, Header = 0.3000000000000001D, Footer = 0.3000000000000001D
            };
            C.PageSetup pageSetup1 = new C.PageSetup()
            {
                Orientation = C.PageSetupOrientationValues.Landscape
            };

            printSettings1.Append(headerFooter1);
            printSettings1.Append(pageMargins1);
            printSettings1.Append(pageSetup1);

            chartSpace1.Append(date19041);
            chartSpace1.Append(editingLanguage1);
            chartSpace1.Append(roundedCorners1);
            chartSpace1.Append(alternateContent1);
            chartSpace1.Append(chart1);
            chartSpace1.Append(shapeProperties2);
            chartSpace1.Append(textProperties1);
            chartSpace1.Append(printSettings1);

            chartPart1.ChartSpace = chartSpace1;
        }
示例#3
0
        private static void GenerateChartPartContentLine(ChartPart part, string formulaCat, string formulaVal, string title)
        {
            C.ChartSpace chartSpace1 = new C.ChartSpace();
            chartSpace1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace1.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            chartSpace1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            chartSpace1.AddNamespaceDeclaration("mv", "urn:schemas-microsoft-com:mac:vml");
            chartSpace1.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");

            C.Chart chart1 = new C.Chart();

            C.Title title1 = new C.Title();

            C.ChartText chartText1 = new C.ChartText();

            C.RichText       richText1       = new C.RichText();
            A.BodyProperties bodyProperties3 = new A.BodyProperties();
            A.ListStyle      listStyle3      = new A.ListStyle();

            A.Paragraph paragraph3 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties3 = new A.ParagraphProperties()
            {
                Level = 0
            };
            A.DefaultRunProperties defaultRunProperties3 = new A.DefaultRunProperties()
            {
                Bold = false
            };

            paragraphProperties3.Append(defaultRunProperties3);

            A.Run  run1  = new A.Run();
            A.Text text1 = new A.Text();
            text1.Text = title;

            run1.Append(text1);

            paragraph3.Append(paragraphProperties3);
            paragraph3.Append(run1);

            richText1.Append(bodyProperties3);
            richText1.Append(listStyle3);
            richText1.Append(paragraph3);

            chartText1.Append(richText1);
            C.Overlay overlay1 = new C.Overlay()
            {
                Val = false
            };

            title1.Append(chartText1);
            title1.Append(overlay1);

            C.PlotArea plotArea1 = new C.PlotArea();
            C.Layout   layout1   = new C.Layout();

            C.LineChart  lineChart1  = new C.LineChart();
            C.VaryColors varyColors1 = new C.VaryColors()
            {
                Val = false
            };


            C.LineChartSeries lineChartSeries1 = new C.LineChartSeries();
            C.Index           index1           = new C.Index()
            {
                Val = (UInt32Value)0U
            };
            C.Order order1 = new C.Order()
            {
                Val = (UInt32Value)0U
            };


            C.ChartShapeProperties chartShapeProperties1 = new C.ChartShapeProperties();

            A.Outline outline1 = new A.Outline()
            {
                Width = 19050, CompoundLineType = A.CompoundLineValues.Single
            };

            A.SolidFill        solidFill1        = new A.SolidFill();
            A.RgbColorModelHex rgbColorModelHex1 = new A.RgbColorModelHex()
            {
                Val = "3366CC"
            };

            solidFill1.Append(rgbColorModelHex1);

            outline1.Append(solidFill1);

            chartShapeProperties1.Append(outline1);

            C.Marker marker1 = new C.Marker();
            C.Symbol symbol1 = new C.Symbol()
            {
                Val = C.MarkerStyleValues.None
            };

            marker1.Append(symbol1);

            C.CategoryAxisData categoryAxisData1 = new C.CategoryAxisData();

            C.StringReference stringReference1 = new C.StringReference();
            C.Formula         formula1         = new C.Formula();
            formula1.Text = formulaCat;

            stringReference1.Append(formula1);

            categoryAxisData1.Append(stringReference1);

            C.Values values1 = new C.Values();

            C.NumberReference numberReference1 = new C.NumberReference();
            C.Formula         formula2         = new C.Formula();
            formula2.Text = formulaVal;

            numberReference1.Append(formula2);

            values1.Append(numberReference1);
            C.Smooth smooth1 = new C.Smooth()
            {
                Val = false
            };

            lineChartSeries1.Append(index1);
            lineChartSeries1.Append(order1);
            lineChartSeries1.Append(chartShapeProperties1);
            lineChartSeries1.Append(marker1);
            lineChartSeries1.Append(categoryAxisData1);
            lineChartSeries1.Append(values1);
            lineChartSeries1.Append(smooth1);
            C.AxisId axisId1 = new C.AxisId()
            {
                Val = (UInt32Value)1923141117U
            };
            C.AxisId axisId2 = new C.AxisId()
            {
                Val = (UInt32Value)2022561148U
            };

            lineChart1.Append(varyColors1);
            lineChart1.Append(lineChartSeries1);
            lineChart1.Append(axisId1);
            lineChart1.Append(axisId2);

            C.CategoryAxis categoryAxis1 = new C.CategoryAxis();
            C.AxisId       axisId3       = new C.AxisId()
            {
                Val = (UInt32Value)1923141117U
            };


            C.Scaling     scaling1     = new C.Scaling();
            C.Orientation orientation1 = new C.Orientation()
            {
                Val = C.OrientationValues.MinMax
            };

            scaling1.Append(orientation1);
            C.Delete delete1 = new C.Delete()
            {
                Val = false
            };
            C.AxisPosition axisPosition1 = new C.AxisPosition()
            {
                Val = C.AxisPositionValues.Bottom
            };

            C.TextProperties textProperties1 = new C.TextProperties();
            A.BodyProperties bodyProperties1 = new A.BodyProperties();
            A.ListStyle      listStyle1      = new A.ListStyle();

            A.Paragraph paragraph1 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties1 = new A.ParagraphProperties()
            {
                Level = 0
            };
            A.DefaultRunProperties defaultRunProperties1 = new A.DefaultRunProperties()
            {
                Bold = false
            };

            paragraphProperties1.Append(defaultRunProperties1);

            paragraph1.Append(paragraphProperties1);

            textProperties1.Append(bodyProperties1);
            textProperties1.Append(listStyle1);
            textProperties1.Append(paragraph1);
            C.CrossingAxis crossingAxis1 = new C.CrossingAxis()
            {
                Val = (UInt32Value)2022561148U
            };

            categoryAxis1.Append(axisId3);
            categoryAxis1.Append(scaling1);
            categoryAxis1.Append(delete1);
            categoryAxis1.Append(axisPosition1);
            categoryAxis1.Append(textProperties1);
            categoryAxis1.Append(crossingAxis1);


            C.ValueAxis valueAxis1 = new C.ValueAxis();
            C.AxisId    axisId4    = new C.AxisId()
            {
                Val = (UInt32Value)2022561148U
            };

            C.Scaling     scaling2     = new C.Scaling();
            C.Orientation orientation2 = new C.Orientation()
            {
                Val = C.OrientationValues.MinMax
            };

            scaling2.Append(orientation2);
            C.Delete delete2 = new C.Delete()
            {
                Val = false
            };
            C.AxisPosition axisPosition2 = new C.AxisPosition()
            {
                Val = C.AxisPositionValues.Left
            };

            C.MajorGridlines majorGridlines1 = new C.MajorGridlines();

            C.ChartShapeProperties chartShapeProperties2 = new C.ChartShapeProperties();

            A.Outline outline2 = new A.Outline();

            A.SolidFill        solidFill2        = new A.SolidFill();
            A.RgbColorModelHex rgbColorModelHex2 = new A.RgbColorModelHex()
            {
                Val = "B7B7B7"
            };

            solidFill2.Append(rgbColorModelHex2);

            outline2.Append(solidFill2);

            chartShapeProperties2.Append(outline2);

            majorGridlines1.Append(chartShapeProperties2);
            C.NumberingFormat numberingFormat1 = new C.NumberingFormat()
            {
                FormatCode = "General", SourceLinked = true
            };
            C.TickLabelPosition tickLabelPosition1 = new C.TickLabelPosition()
            {
                Val = C.TickLabelPositionValues.NextTo
            };

            C.ChartShapeProperties chartShapeProperties3 = new C.ChartShapeProperties();

            A.Outline outline3 = new A.Outline()
            {
                Width = 47625
            };
            A.NoFill noFill1 = new A.NoFill();

            outline3.Append(noFill1);

            chartShapeProperties3.Append(outline3);

            C.TextProperties textProperties2 = new C.TextProperties();
            A.BodyProperties bodyProperties2 = new A.BodyProperties();
            A.ListStyle      listStyle2      = new A.ListStyle();

            A.Paragraph paragraph2 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties2 = new A.ParagraphProperties()
            {
                Level = 0
            };
            A.DefaultRunProperties defaultRunProperties2 = new A.DefaultRunProperties()
            {
                Bold = false
            };

            paragraphProperties2.Append(defaultRunProperties2);

            paragraph2.Append(paragraphProperties2);

            textProperties2.Append(bodyProperties2);
            textProperties2.Append(listStyle2);
            textProperties2.Append(paragraph2);
            C.CrossingAxis crossingAxis2 = new C.CrossingAxis()
            {
                Val = (UInt32Value)1923141117U
            };

            valueAxis1.Append(axisId4);
            valueAxis1.Append(scaling2);
            valueAxis1.Append(delete2);
            valueAxis1.Append(axisPosition2);
            valueAxis1.Append(majorGridlines1);
            valueAxis1.Append(numberingFormat1);
            valueAxis1.Append(tickLabelPosition1);
            valueAxis1.Append(chartShapeProperties3);
            valueAxis1.Append(textProperties2);
            valueAxis1.Append(crossingAxis2);

            plotArea1.Append(layout1);
            plotArea1.Append(lineChart1);
            plotArea1.Append(categoryAxis1);
            plotArea1.Append(valueAxis1);

            C.Legend         legend1         = new C.Legend();
            C.LegendPosition legendPosition1 = new C.LegendPosition()
            {
                Val = C.LegendPositionValues.Right
            };
            C.Overlay overlay2 = new C.Overlay()
            {
                Val = false
            };

            legend1.Append(legendPosition1);
            legend1.Append(overlay2);
            C.PlotVisibleOnly plotVisibleOnly1 = new C.PlotVisibleOnly()
            {
                Val = true
            };

            chart1.Append(title1);
            chart1.Append(plotArea1);
            chart1.Append(legend1);
            chart1.Append(plotVisibleOnly1);

            chartSpace1.Append(chart1);

            part.ChartSpace = chartSpace1;
        }
示例#4
0
        private static void GenerateChartPartContentPie(ChartPart chartPart1, string formulaCat, string formulaVal, string title)
        {
            C.ChartSpace chartSpace1 = new C.ChartSpace();
            chartSpace1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace1.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            chartSpace1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            chartSpace1.AddNamespaceDeclaration("mv", "urn:schemas-microsoft-com:mac:vml");
            chartSpace1.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");



            C.Chart chart1 = new C.Chart();

            C.Title title1 = new C.Title();

            C.ChartText chartText1 = new C.ChartText();

            C.RichText       richText1       = new C.RichText();
            A.BodyProperties bodyProperties1 = new A.BodyProperties();
            A.ListStyle      listStyle1      = new A.ListStyle();

            A.Paragraph paragraph1 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties1 = new A.ParagraphProperties()
            {
                Level = 0
            };
            A.DefaultRunProperties defaultRunProperties1 = new A.DefaultRunProperties()
            {
                Bold = false
            };

            paragraphProperties1.Append(defaultRunProperties1);

            A.Run  run1  = new A.Run();
            A.Text text1 = new A.Text();
            text1.Text = title;

            run1.Append(text1);

            paragraph1.Append(paragraphProperties1);
            paragraph1.Append(run1);

            richText1.Append(bodyProperties1);
            richText1.Append(listStyle1);
            richText1.Append(paragraph1);

            chartText1.Append(richText1);
            C.Overlay overlay1 = new C.Overlay()
            {
                Val = false
            };

            title1.Append(chartText1);
            title1.Append(overlay1);



            C.PlotArea plotArea1 = new C.PlotArea();
            C.Layout   layout1   = new C.Layout();


            C.PieChart   pieChart1   = new C.PieChart();
            C.VaryColors varyColors1 = new C.VaryColors()
            {
                Val = true
            };

            C.PieChartSeries pieChartSeries1 = new C.PieChartSeries();
            C.Index          index1          = new C.Index()
            {
                Val = (UInt32Value)0U
            };
            C.Order order1 = new C.Order()
            {
                Val = (UInt32Value)0U
            };

            C.DataLabels    dataLabels1    = new C.DataLabels();
            C.ShowLegendKey showLegendKey1 = new C.ShowLegendKey()
            {
                Val = false
            };
            C.ShowValue showValue1 = new C.ShowValue()
            {
                Val = false
            };
            C.ShowCategoryName showCategoryName1 = new C.ShowCategoryName()
            {
                Val = false
            };
            C.ShowSeriesName showSeriesName1 = new C.ShowSeriesName()
            {
                Val = false
            };
            C.ShowPercent showPercent1 = new C.ShowPercent()
            {
                Val = true
            };
            C.ShowBubbleSize showBubbleSize1 = new C.ShowBubbleSize()
            {
                Val = false
            };
            C.ShowLeaderLines showLeaderLines1 = new C.ShowLeaderLines()
            {
                Val = true
            };

            dataLabels1.Append(showLegendKey1);
            dataLabels1.Append(showValue1);
            dataLabels1.Append(showCategoryName1);
            dataLabels1.Append(showSeriesName1);
            dataLabels1.Append(showPercent1);
            dataLabels1.Append(showBubbleSize1);
            dataLabels1.Append(showLeaderLines1);

            C.CategoryAxisData categoryAxisData1 = new C.CategoryAxisData();

            C.StringReference stringReference1 = new C.StringReference();
            C.Formula         formula1         = new C.Formula();
            formula1.Text = formulaCat;

            stringReference1.Append(formula1);

            categoryAxisData1.Append(stringReference1);

            C.Values values1 = new C.Values();

            C.NumberReference numberReference1 = new C.NumberReference();
            C.Formula         formula2         = new C.Formula();
            formula2.Text = formulaVal;

            numberReference1.Append(formula2);

            values1.Append(numberReference1);

            pieChartSeries1.Append(index1);
            pieChartSeries1.Append(order1);
            pieChartSeries1.Append(dataLabels1);
            pieChartSeries1.Append(categoryAxisData1);
            pieChartSeries1.Append(values1);

            C.DataLabels    dataLabels2    = new C.DataLabels();
            C.ShowLegendKey showLegendKey2 = new C.ShowLegendKey()
            {
                Val = false
            };
            C.ShowValue showValue2 = new C.ShowValue()
            {
                Val = false
            };
            C.ShowCategoryName showCategoryName2 = new C.ShowCategoryName()
            {
                Val = false
            };
            C.ShowSeriesName showSeriesName2 = new C.ShowSeriesName()
            {
                Val = false
            };
            C.ShowPercent showPercent2 = new C.ShowPercent()
            {
                Val = true
            };
            C.ShowBubbleSize showBubbleSize2 = new C.ShowBubbleSize()
            {
                Val = false
            };

            dataLabels2.Append(showLegendKey2);
            dataLabels2.Append(showValue2);
            dataLabels2.Append(showCategoryName2);
            dataLabels2.Append(showSeriesName2);
            dataLabels2.Append(showPercent2);
            dataLabels2.Append(showBubbleSize2);
            C.FirstSliceAngle firstSliceAngle1 = new C.FirstSliceAngle()
            {
                Val = (UInt16Value)0U
            };

            pieChart1.Append(varyColors1);
            pieChart1.Append(pieChartSeries1);
            pieChart1.Append(dataLabels2);
            pieChart1.Append(firstSliceAngle1);

            C.ShapeProperties shapeProperties1 = new C.ShapeProperties();

            A.SolidFill        solidFill4        = new A.SolidFill();
            A.RgbColorModelHex rgbColorModelHex4 = new A.RgbColorModelHex()
            {
                Val = "FFFFFF"
            };

            solidFill4.Append(rgbColorModelHex4);

            shapeProperties1.Append(solidFill4);

            plotArea1.Append(layout1);
            plotArea1.Append(pieChart1);
            plotArea1.Append(shapeProperties1);

            C.Legend         legend1         = new C.Legend();
            C.LegendPosition legendPosition1 = new C.LegendPosition()
            {
                Val = C.LegendPositionValues.Right
            };
            C.Overlay overlay2 = new C.Overlay()
            {
                Val = false
            };

            legend1.Append(legendPosition1);
            legend1.Append(overlay2);
            C.PlotVisibleOnly plotVisibleOnly1 = new C.PlotVisibleOnly()
            {
                Val = true
            };

            chart1.Append(title1);
            chart1.Append(plotArea1);
            chart1.Append(legend1);
            chart1.Append(plotVisibleOnly1);

            chartSpace1.Append(chart1);

            chartPart1.ChartSpace = chartSpace1;
        }
示例#5
0
        protected virtual Title GenerateTitle(string text, Int32Value fontSize)
        {
            Title title1 = new Title();

            ChartText chartText1 = new ChartText();

            RichText richText1 = new RichText();
            A::BodyProperties bodyProperties1 = new A::BodyProperties();
            A::ListStyle listStyle1 = new A::ListStyle();

            A::Paragraph paragraph1 = new A::Paragraph();

            A::ParagraphProperties paragraphProperties1 = new A::ParagraphProperties();
            A::DefaultRunProperties defaultRunProperties1 = new A::DefaultRunProperties() { Language = DEFAULT_LANG, FontSize = DEFAULT_FONT_SIZE };

            paragraphProperties1.Append(defaultRunProperties1);

            A::Run run1 = new A::Run();
            A::RunProperties runProperties1 = new A::RunProperties() { Language = DEFAULT_LANG, FontSize = fontSize };
            A::Text text1 = new A::Text();
            text1.Text = text;

            run1.Append(runProperties1);
            run1.Append(text1);

            paragraph1.Append(paragraphProperties1);
            paragraph1.Append(run1);

            richText1.Append(bodyProperties1);
            richText1.Append(listStyle1);
            richText1.Append(paragraph1);

            chartText1.Append(richText1);

            Layout layout1 = new Layout();

            title1.Append(chartText1);
            title1.Append(layout1);

            return title1;
        }