Exemple #1
0
        internal C.PieChartSeries ToPieChartSeries()
        {
            C.PieChartSeries pcs = new C.PieChartSeries();
            pcs.Index = new C.Index() { Val = this.Index };
            pcs.Order = new C.Order() { Val = this.Order };

            if (this.IsStringReference != null)
            {
                pcs.SeriesText = new C.SeriesText();
                if (this.IsStringReference.Value)
                {
                    pcs.SeriesText.StringReference = this.StringReference.ToStringReference();
                }
                else
                {
                    pcs.SeriesText.NumericValue = new C.NumericValue(this.NumericValue);
                }
            }

            if (this.Options.ShapeProperties.HasShapeProperties)
            {
                pcs.ChartShapeProperties = this.Options.ShapeProperties.ToChartShapeProperties();
            }

            if (this.Options.iExplosion != null)
            {
                pcs.Explosion = new C.Explosion() { Val = this.Options.Explosion };
            }

            if (this.DataPointOptionsList.Count > 0)
            {
                List<int> indexlist = this.DataPointOptionsList.Keys.ToList<int>();
                indexlist.Sort();
                int index;
                for (int i = 0; i < indexlist.Count; ++i)
                {
                    index = indexlist[i];
                    pcs.Append(this.DataPointOptionsList[index].ToDataPoint(index));
                }
            }

            if (this.GroupDataLabelOptions != null || this.DataLabelOptionsList.Count > 0)
            {
                if (this.GroupDataLabelOptions == null)
                {
                    SLGroupDataLabelOptions gdloptions = new SLGroupDataLabelOptions(new List<System.Drawing.Color>());
                    pcs.Append(gdloptions.ToDataLabels(this.DataLabelOptionsList, true));
                }
                else
                {
                    pcs.Append(this.GroupDataLabelOptions.ToDataLabels(this.DataLabelOptionsList, false));
                }
            }

            pcs.Append(this.AxisData.ToCategoryAxisData());
            pcs.Append(this.NumberData.ToValues());
            
            return pcs;
        }
Exemple #2
0
        internal C.PieChartSeries ToPieChartSeries(bool IsStylish = false)
        {
            C.PieChartSeries pcs = new C.PieChartSeries();
            pcs.Index = new C.Index()
            {
                Val = this.Index
            };
            pcs.Order = new C.Order()
            {
                Val = this.Order
            };

            if (this.IsStringReference != null)
            {
                pcs.SeriesText = new C.SeriesText();
                if (this.IsStringReference.Value)
                {
                    pcs.SeriesText.StringReference = this.StringReference.ToStringReference();
                }
                else
                {
                    pcs.SeriesText.NumericValue = new C.NumericValue(this.NumericValue);
                }
            }

            if (this.Options.ShapeProperties.HasShapeProperties)
            {
                pcs.ChartShapeProperties = this.Options.ShapeProperties.ToChartShapeProperties(IsStylish);
            }

            if (this.Options.iExplosion != null)
            {
                pcs.Explosion = new C.Explosion()
                {
                    Val = this.Options.Explosion
                };
            }

            if (this.DataPointOptionsList.Count > 0)
            {
                List <int> indexlist = this.DataPointOptionsList.Keys.ToList <int>();
                indexlist.Sort();
                int index;
                for (int i = 0; i < indexlist.Count; ++i)
                {
                    index = indexlist[i];
                    pcs.Append(this.DataPointOptionsList[index].ToDataPoint(index, IsStylish));
                }
            }

            if (this.GroupDataLabelOptions != null || this.DataLabelOptionsList.Count > 0)
            {
                if (this.GroupDataLabelOptions == null)
                {
                    SLGroupDataLabelOptions gdloptions = new SLGroupDataLabelOptions(new List <System.Drawing.Color>());
                    pcs.Append(gdloptions.ToDataLabels(this.DataLabelOptionsList, true));
                }
                else
                {
                    pcs.Append(this.GroupDataLabelOptions.ToDataLabels(this.DataLabelOptionsList, false));
                }
            }

            pcs.Append(this.AxisData.ToCategoryAxisData());
            pcs.Append(this.NumberData.ToValues());

            return(pcs);
        }
        public Chart GenerateChart(string title, List<AssetWeighting> model)
        {
            Chart chart1 = new Chart();
            Title title1 = GenerateTitle(title);

            View3D view3D1 = new View3D();
            RotateX rotateX1 = new RotateX() { Val = 30 };
            Perspective perspective1 = new Perspective() { Val = 30 };

            view3D1.Append(rotateX1);
            view3D1.Append(perspective1);

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

            Pie3DChart pie3DChart1 = new Pie3DChart();
            VaryColors varyColors1 = new VaryColors() { Val = true };

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

            // c:tx series text
            SeriesText seriesText1 = GenerateSeriesText(title, GraphData.DataColumn);

            // c:cat category axis data
            var categoryData = model.OrderByDescending(m => m.Weighting).Select(n => n.AssetClass);
            GraphData.AddTextColumn(categoryName, categoryData);
            CategoryAxisData categoryAxisData1 = GenerateCategoryAxisData(categoryData, GraphData.TextColumn);

            // c:val values
            var valuesData = model.OrderByDescending(m => m.Weighting).Select(n => n.Weighting ?? 0).ToArray();
            string valuesColumn = GraphData.AddDataColumn(seriesName, valuesData);
            Values values1 = GenerateValues(valueFormat, valuesData, valuesColumn);

            //var series = from m in model
            //             orderby m.Weighting descending
            //             select new TextSeries { Name = m.AssetClass, Values = (new List<double>() { m.Weighting ?? 0 }) };

            //string[] headers = { categoryName, seriesName };
            //GraphData.AddTextSeries(headers, series);

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

            pie3DChart1.Append(varyColors1);
            pie3DChart1.Append(pieChartSeries1);

            plotArea1.Append(layout1);
            plotArea1.Append(pie3DChart1);

            Legend legend1 = GenerateLegend(LegendPositionValues.Right);
            PlotVisibleOnly plotVisibleOnly1 = new PlotVisibleOnly() { Val = true };

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

            return chart1;
        }
        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;
        }
        // Create Chart in Word document
        public void CreateChart(List <ChartSubArea> chartList)
        {
            // Get MainDocumentPart of Document
            MainDocumentPart mainPart = document.AddMainDocumentPart();

            mainPart.Document = new Document(new Body());

            // Create ChartPart object in Word Document
            ChartPart chartPart = mainPart.AddNewPart <ChartPart>("rId110");

            // the root element of chartPart
            dc.ChartSpace chartSpace = new dc.ChartSpace();
            chartSpace.Append(new dc.EditingLanguage()
            {
                Val = "en-us"
            });

            // Create Chart
            dc.Chart chart = new dc.Chart();
            chart.Append(new dc.AutoTitleDeleted()
            {
                Val = true
            });

            // Define the 3D view
            dc.View3D view3D = new dc.View3D();
            view3D.Append(new dc.RotateX()
            {
                Val = 30
            });
            view3D.Append(new dc.RotateY()
            {
                Val = 0
            });

            // Intiliazes a new instance of the PlotArea class
            dc.PlotArea plotArea = new dc.PlotArea();
            plotArea.Append(new dc.Layout());

            // the type of Chart
            dc.Pie3DChart pie3DChart = new dc.Pie3DChart();
            pie3DChart.Append(new dc.VaryColors()
            {
                Val = true
            });
            dc.PieChartSeries pieChartSers = new dc.PieChartSeries();
            pieChartSers.Append(new dc.Index()
            {
                Val = 0U
            });
            pieChartSers.Append(new dc.Order()
            {
                Val = 0U
            });
            dc.SeriesText seriesText = new dc.SeriesText();
            seriesText.Append(new dc.NumericValue()
            {
                Text = "Series"
            });

            uint   rowcount = 0;
            uint   count    = UInt32.Parse(chartList.Count.ToString());
            string endCell  = (count + 1).ToString();

            dc.ChartShapeProperties chartShapePros = new dc.ChartShapeProperties();

            // Define cell for lable information
            dc.CategoryAxisData cateAxisData = new dc.CategoryAxisData();
            dc.StringReference  stringRef    = new dc.StringReference();
            stringRef.Append(new dc.Formula()
            {
                Text = "Main!$A$2:$A$" + endCell
            });
            dc.StringCache stringCache = new dc.StringCache();
            stringCache.Append(new dc.PointCount()
            {
                Val = count
            });

            // Define cells for value information
            dc.Values          values = new dc.Values();
            dc.NumberReference numRef = new dc.NumberReference();
            numRef.Append(new dc.Formula()
            {
                Text = "Main!$B$2:$B$" + endCell
            });

            dc.NumberingCache numCache = new dc.NumberingCache();
            numCache.Append(new dc.FormatCode()
            {
                Text = "General"
            });
            numCache.Append(new dc.PointCount()
            {
                Val = count
            });

            // Fill data for chart
            foreach (var item in chartList)
            {
                if (count == 0)
                {
                    chartShapePros.Append(new d.SolidFill(new d.SchemeColor()
                    {
                        Val = item.Color
                    }));
                    pieChartSers.Append(chartShapePros);
                }
                else
                {
                    dc.DataPoint dataPoint = new dc.DataPoint();
                    dataPoint.Append(new dc.Index()
                    {
                        Val = rowcount
                    });
                    chartShapePros = new dc.ChartShapeProperties();
                    chartShapePros.Append(new d.SolidFill(new d.SchemeColor()
                    {
                        Val = item.Color
                    }));
                    dataPoint.Append(chartShapePros);
                    pieChartSers.Append(dataPoint);
                }

                dc.StringPoint stringPoint = new dc.StringPoint()
                {
                    Index = rowcount
                };
                stringPoint.Append(new dc.NumericValue()
                {
                    Text = item.Label
                });
                stringCache.Append(stringPoint);

                dc.NumericPoint numericPoint = new dc.NumericPoint()
                {
                    Index = rowcount
                };
                numericPoint.Append(new dc.NumericValue()
                {
                    Text = item.Value
                });
                numCache.Append(numericPoint);
                rowcount++;
            }

            // Create c:cat and c:val element
            stringRef.Append(stringCache);
            cateAxisData.Append(stringRef);
            numRef.Append(numCache);
            values.Append(numRef);

            // Append c:cat and c:val to the end of c:ser element
            pieChartSers.Append(cateAxisData);
            pieChartSers.Append(values);

            // Append c:ser to the end of c:pie3DChart element
            pie3DChart.Append(pieChartSers);

            // Append c:pie3DChart to the end of s:plotArea element
            plotArea.Append(pie3DChart);

            // create child elements of the c:legend element
            dc.Legend legend = new dc.Legend();
            legend.Append(new dc.LegendPosition()
            {
                Val = LegendPositionValues.Right
            });
            dc.Overlay overlay = new dc.Overlay()
            {
                Val = false
            };
            legend.Append(overlay);

            dc.TextProperties textPros = new TextProperties();
            textPros.Append(new d.BodyProperties());
            textPros.Append(new d.ListStyle());

            d.Paragraph                  paragraph       = new d.Paragraph();
            d.ParagraphProperties        paraPros        = new d.ParagraphProperties();
            d.DefaultParagraphProperties defaultParaPros = new d.DefaultParagraphProperties();
            defaultParaPros.Append(new d.LatinFont()
            {
                Typeface = "Arial", PitchFamily = 34, CharacterSet = 0
            });
            defaultParaPros.Append(new d.ComplexScriptFont()
            {
                Typeface = "Arial", PitchFamily = 34, CharacterSet = 0
            });
            paraPros.Append(defaultParaPros);
            paragraph.Append(paraPros);
            paragraph.Append(new d.EndParagraphRunProperties()
            {
                Language = "en-Us"
            });

            textPros.Append(paragraph);
            legend.Append(textPros);

            // Append c:view3D, c:plotArea and c:legend elements to the end of c:chart element
            chart.Append(view3D);
            chart.Append(plotArea);
            chart.Append(legend);

            // Append the c:chart element to the end of c:chartSpace element
            chartSpace.Append(chart);

            // Create c:spPr Elements and fill the child elements of it
            chartShapePros = new dc.ChartShapeProperties();
            d.Outline outline = new d.Outline();
            outline.Append(new d.NoFill());
            chartShapePros.Append(outline);

            // Append c:spPr element to the end of c:chartSpace element
            chartSpace.Append(chartShapePros);

            chartPart.ChartSpace = chartSpace;

            // Generate content of the MainDocumentPart
            GeneratePartContent(mainPart);
        }
        // Generates content of chartPart2.
        private void GenerateChartPart2Content(ChartPart chartPart2)
        {
            C.ChartSpace chartSpace2 = new C.ChartSpace();
            chartSpace2.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace2.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace2.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            C.Date1904 date19042 = new C.Date1904() { Val = false };
            C.EditingLanguage editingLanguage2 = new C.EditingLanguage() { Val = "en-US" };
            C.RoundedCorners roundedCorners2 = new C.RoundedCorners() { Val = false };

            AlternateContent alternateContent2 = new AlternateContent();
            alternateContent2.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            AlternateContentChoice alternateContentChoice2 = new AlternateContentChoice() { Requires = "c14" };
            alternateContentChoice2.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            C14.Style style3 = new C14.Style() { Val = 102 };

            alternateContentChoice2.Append(style3);

            AlternateContentFallback alternateContentFallback2 = new AlternateContentFallback();
            C.Style style4 = new C.Style() { Val = 2 };

            alternateContentFallback2.Append(style4);

            alternateContent2.Append(alternateContentChoice2);
            alternateContent2.Append(alternateContentFallback2);

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

            C.Title title1 = new C.Title();
            C.Overlay overlay2 = new C.Overlay() { Val = false };

            title1.Append(overlay2);
            C.AutoTitleDeleted autoTitleDeleted2 = new C.AutoTitleDeleted() { Val = false };

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

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

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

            C.SeriesText seriesText4 = new C.SeriesText();

            C.StringReference stringReference7 = new C.StringReference();
            C.Formula formula10 = new C.Formula();
            formula10.Text = "Sheet1!$B$1";

            C.StringCache stringCache7 = new C.StringCache();
            C.PointCount pointCount10 = new C.PointCount() { Val = (UInt32Value)1U };

            C.StringPoint stringPoint16 = new C.StringPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue28 = new C.NumericValue();
            numericValue28.Text = "Cases By Aging";

            stringPoint16.Append(numericValue28);

            stringCache7.Append(pointCount10);
            stringCache7.Append(stringPoint16);

            stringReference7.Append(formula10);
            stringReference7.Append(stringCache7);

            seriesText4.Append(stringReference7);

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

            C.StringReference stringReference8 = new C.StringReference();
            C.Formula formula11 = new C.Formula();
            formula11.Text = "Sheet1!$A$2:$A$5";

            C.StringCache stringCache8 = new C.StringCache();
            C.PointCount pointCount11 = new C.PointCount() { Val = (UInt32Value)4U };

            C.StringPoint stringPoint17 = new C.StringPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue29 = new C.NumericValue();
            numericValue29.Text = "1st Qtr";

            stringPoint17.Append(numericValue29);

            C.StringPoint stringPoint18 = new C.StringPoint() { Index = (UInt32Value)1U };
            C.NumericValue numericValue30 = new C.NumericValue();
            numericValue30.Text = "2nd Qtr";

            stringPoint18.Append(numericValue30);

            C.StringPoint stringPoint19 = new C.StringPoint() { Index = (UInt32Value)2U };
            C.NumericValue numericValue31 = new C.NumericValue();
            numericValue31.Text = "3rd Qtr";

            stringPoint19.Append(numericValue31);

            C.StringPoint stringPoint20 = new C.StringPoint() { Index = (UInt32Value)3U };
            C.NumericValue numericValue32 = new C.NumericValue();
            numericValue32.Text = "4th Qtr";

            stringPoint20.Append(numericValue32);

            stringCache8.Append(pointCount11);
            stringCache8.Append(stringPoint17);
            stringCache8.Append(stringPoint18);
            stringCache8.Append(stringPoint19);
            stringCache8.Append(stringPoint20);

            stringReference8.Append(formula11);
            stringReference8.Append(stringCache8);

            categoryAxisData4.Append(stringReference8);

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

            C.NumberReference numberReference4 = new C.NumberReference();
            C.Formula formula12 = new C.Formula();
            formula12.Text = "Sheet1!$B$2:$B$5";
            C.NumberingCache numberingCache4 = new C.NumberingCache();
            C.FormatCode formatCode4 = new C.FormatCode();
            formatCode4.Text = "General";
            C.PointCount pointCount12 = new C.PointCount() { Val = (UInt32Value)4U };

            numberingCache4.Append(formatCode4);
            numberingCache4.Append(pointCount12);

            for (int i = 0; i <= 3; i++)
            {
                C.NumericPoint numericPoint13 = new C.NumericPoint() { Index = UInt32Value.FromUInt32((uint)i) };
                C.NumericValue numericValue33 = new C.NumericValue();
                //numericValue33.Text = (10*(i+1)).ToString();
                numericValue33.Text = "25";
                numericPoint13.Append(numericValue33);
                numberingCache4.Append(numericPoint13);
            }

               /* C.NumericPoint numericPoint13 = new C.NumericPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue33 = new C.NumericValue();
            numericValue33.Text = "99";

            numericPoint13.Append(numericValue33);

            C.NumericPoint numericPoint14 = new C.NumericPoint() { Index = (UInt32Value)1U };
            C.NumericValue numericValue34 = new C.NumericValue();
            numericValue34.Text = "3.2";

            numericPoint14.Append(numericValue34);

            C.NumericPoint numericPoint15 = new C.NumericPoint() { Index = (UInt32Value)2U };
            C.NumericValue numericValue35 = new C.NumericValue();
            numericValue35.Text = "1.4";

            numericPoint15.Append(numericValue35);

            C.NumericPoint numericPoint16 = new C.NumericPoint() { Index = (UInt32Value)3U };
            C.NumericValue numericValue36 = new C.NumericValue();
            numericValue36.Text = "1.2";

            numericPoint16.Append(numericValue36);

            numberingCache4.Append(formatCode4);
            numberingCache4.Append(pointCount12);
            numberingCache4.Append(numericPoint13);
            numberingCache4.Append(numericPoint14);
            numberingCache4.Append(numericPoint15);
            numberingCache4.Append(numericPoint16); */

            numberReference4.Append(formula12);
            numberReference4.Append(numberingCache4);

            values4.Append(numberReference4);

            pieChartSeries1.Append(index4);
            pieChartSeries1.Append(order4);
            pieChartSeries1.Append(seriesText4);
            pieChartSeries1.Append(categoryAxisData4);
            pieChartSeries1.Append(values4);

            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 = false };
            C.ShowBubbleSize showBubbleSize2 = new C.ShowBubbleSize() { Val = false };
            C.ShowLeaderLines showLeaderLines1 = new C.ShowLeaderLines() { Val = true };

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

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

            plotArea2.Append(layout2);
            plotArea2.Append(pieChart1);

            C.Legend legend2 = new C.Legend();
            C.LegendPosition legendPosition2 = new C.LegendPosition() { Val = C.LegendPositionValues.Right };
            C.Overlay overlay3 = new C.Overlay() { Val = false };

            legend2.Append(legendPosition2);
            legend2.Append(overlay3);
            C.PlotVisibleOnly plotVisibleOnly2 = new C.PlotVisibleOnly() { Val = true };
            C.DisplayBlanksAs displayBlanksAs2 = new C.DisplayBlanksAs() { Val = C.DisplayBlanksAsValues.Gap };
            C.ShowDataLabelsOverMaximum showDataLabelsOverMaximum2 = new C.ShowDataLabelsOverMaximum() { Val = false };

            chart2.Append(title1);
            chart2.Append(autoTitleDeleted2);
            chart2.Append(plotArea2);
            chart2.Append(legend2);
            chart2.Append(plotVisibleOnly2);
            chart2.Append(displayBlanksAs2);
            chart2.Append(showDataLabelsOverMaximum2);

            C.ExternalData externalData2 = new C.ExternalData() { Id = "rId1" };
            C.AutoUpdate autoUpdate2 = new C.AutoUpdate() { Val = false };

            externalData2.Append(autoUpdate2);

            chartSpace2.Append(date19042);
            chartSpace2.Append(editingLanguage2);
            chartSpace2.Append(roundedCorners2);
            chartSpace2.Append(alternateContent2);
            chartSpace2.Append(chart2);
            chartSpace2.Append(externalData2);

            chartPart2.ChartSpace = chartSpace2;
        }
        // Generates content of chartPart7.
        private void GenerateChartPart7Content(ChartPart chartPart7)
        {
            C.ChartSpace chartSpace7 = new C.ChartSpace();
            chartSpace7.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace7.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace7.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            C.Date1904 date19047 = new C.Date1904(){ Val = false };
            C.EditingLanguage editingLanguage7 = new C.EditingLanguage(){ Val = "en-US" };
            C.RoundedCorners roundedCorners7 = new C.RoundedCorners(){ Val = false };

            AlternateContent alternateContent16 = new AlternateContent();
            alternateContent16.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            AlternateContentChoice alternateContentChoice16 = new AlternateContentChoice(){ Requires = "c14" };
            alternateContentChoice16.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            C14.Style style13 = new C14.Style(){ Val = 102 };

            alternateContentChoice16.Append(style13);

            AlternateContentFallback alternateContentFallback15 = new AlternateContentFallback();
            C.Style style14 = new C.Style(){ Val = 2 };

            alternateContentFallback15.Append(style14);

            alternateContent16.Append(alternateContentChoice16);
            alternateContent16.Append(alternateContentFallback15);

            C.PivotSource pivotSource7 = new C.PivotSource();
            C.PivotTableName pivotTableName7 = new C.PivotTableName();
            pivotTableName7.Text = "[GeneratedDocument.xlsx]ShowHeader!PivotTable1";
            C.FormatId formatId7 = new C.FormatId(){ Val = (UInt32Value)10U };

            pivotSource7.Append(pivotTableName7);
            pivotSource7.Append(formatId7);

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

            C.Title title7 = new C.Title();
            C.Overlay overlay13 = new C.Overlay(){ Val = false };

            title7.Append(overlay13);
            C.AutoTitleDeleted autoTitleDeleted7 = new C.AutoTitleDeleted(){ Val = false };

            C.PivotFormats pivotFormats7 = new C.PivotFormats();

            C.PivotFormat pivotFormat47 = new C.PivotFormat();
            C.Index index53 = new C.Index(){ Val = (UInt32Value)0U };

            C.Marker marker47 = new C.Marker();
            C.Symbol symbol47 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker47.Append(symbol47);

            pivotFormat47.Append(index53);
            pivotFormat47.Append(marker47);

            C.PivotFormat pivotFormat48 = new C.PivotFormat();
            C.Index index54 = new C.Index(){ Val = (UInt32Value)1U };

            C.Marker marker48 = new C.Marker();
            C.Symbol symbol48 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker48.Append(symbol48);

            pivotFormat48.Append(index54);
            pivotFormat48.Append(marker48);

            C.PivotFormat pivotFormat49 = new C.PivotFormat();
            C.Index index55 = new C.Index(){ Val = (UInt32Value)2U };

            C.Marker marker49 = new C.Marker();
            C.Symbol symbol49 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker49.Append(symbol49);

            pivotFormat49.Append(index55);
            pivotFormat49.Append(marker49);

            pivotFormats7.Append(pivotFormat47);
            pivotFormats7.Append(pivotFormat48);
            pivotFormats7.Append(pivotFormat49);

            C.PlotArea plotArea7 = new C.PlotArea();
            C.Layout layout7 = new C.Layout();

            C.PieChart pieChart4 = new C.PieChart();
            C.VaryColors varyColors7 = new C.VaryColors(){ Val = true };

            C.PieChartSeries pieChartSeries4 = new C.PieChartSeries();
            C.Index index56 = new C.Index(){ Val = (UInt32Value)0U };
            C.Order order7 = new C.Order(){ Val = (UInt32Value)0U };

            C.SeriesText seriesText7 = new C.SeriesText();

            C.StringReference stringReference13 = new C.StringReference();
            C.Formula formula19 = new C.Formula();
            formula19.Text = "ShowHeader!$B$1";

            C.StringCache stringCache13 = new C.StringCache();
            C.PointCount pointCount19 = new C.PointCount(){ Val = (UInt32Value)1U };

            C.StringPoint stringPoint25 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue43 = new C.NumericValue();
            numericValue43.Text = "Total";

            stringPoint25.Append(numericValue43);

            stringCache13.Append(pointCount19);
            stringCache13.Append(stringPoint25);

            stringReference13.Append(formula19);
            stringReference13.Append(stringCache13);

            seriesText7.Append(stringReference13);

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

            C.StringReference stringReference14 = new C.StringReference();
            C.Formula formula20 = new C.Formula();
            formula20.Text = "ShowHeader!$A$2:$A$5";

            C.StringCache stringCache14 = new C.StringCache();
            C.PointCount pointCount20 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.StringPoint stringPoint26 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue44 = new C.NumericValue();
            numericValue44.Text = "product_A";

            stringPoint26.Append(numericValue44);

            C.StringPoint stringPoint27 = new C.StringPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue45 = new C.NumericValue();
            numericValue45.Text = "product_D";

            stringPoint27.Append(numericValue45);

            C.StringPoint stringPoint28 = new C.StringPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue46 = new C.NumericValue();
            numericValue46.Text = "product_E";

            stringPoint28.Append(numericValue46);

            stringCache14.Append(pointCount20);
            stringCache14.Append(stringPoint26);
            stringCache14.Append(stringPoint27);
            stringCache14.Append(stringPoint28);

            stringReference14.Append(formula20);
            stringReference14.Append(stringCache14);

            categoryAxisData7.Append(stringReference14);

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

            C.NumberReference numberReference7 = new C.NumberReference();
            C.Formula formula21 = new C.Formula();
            formula21.Text = "ShowHeader!$B$2:$B$5";

            C.NumberingCache numberingCache7 = new C.NumberingCache();
            C.FormatCode formatCode7 = new C.FormatCode();
            formatCode7.Text = "General";
            C.PointCount pointCount21 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.NumericPoint numericPoint19 = new C.NumericPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue47 = new C.NumericValue();
            numericValue47.Text = "19";

            numericPoint19.Append(numericValue47);

            C.NumericPoint numericPoint20 = new C.NumericPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue48 = new C.NumericValue();
            numericValue48.Text = "13";

            numericPoint20.Append(numericValue48);

            C.NumericPoint numericPoint21 = new C.NumericPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue49 = new C.NumericValue();
            numericValue49.Text = "33";

            numericPoint21.Append(numericValue49);

            numberingCache7.Append(formatCode7);
            numberingCache7.Append(pointCount21);
            numberingCache7.Append(numericPoint19);
            numberingCache7.Append(numericPoint20);
            numberingCache7.Append(numericPoint21);

            numberReference7.Append(formula21);
            numberReference7.Append(numberingCache7);

            values7.Append(numberReference7);

            pieChartSeries4.Append(index56);
            pieChartSeries4.Append(order7);
            pieChartSeries4.Append(seriesText7);
            pieChartSeries4.Append(categoryAxisData7);
            pieChartSeries4.Append(values7);

            C.DataLabels dataLabels7 = new C.DataLabels();
            C.ShowLegendKey showLegendKey7 = new C.ShowLegendKey(){ Val = false };
            C.ShowValue showValue7 = new C.ShowValue(){ Val = false };
            C.ShowCategoryName showCategoryName7 = new C.ShowCategoryName(){ Val = false };
            C.ShowSeriesName showSeriesName7 = new C.ShowSeriesName(){ Val = false };
            C.ShowPercent showPercent7 = new C.ShowPercent(){ Val = false };
            C.ShowBubbleSize showBubbleSize7 = new C.ShowBubbleSize(){ Val = false };
            C.ShowLeaderLines showLeaderLines4 = new C.ShowLeaderLines(){ Val = true };

            dataLabels7.Append(showLegendKey7);
            dataLabels7.Append(showValue7);
            dataLabels7.Append(showCategoryName7);
            dataLabels7.Append(showSeriesName7);
            dataLabels7.Append(showPercent7);
            dataLabels7.Append(showBubbleSize7);
            dataLabels7.Append(showLeaderLines4);
            C.FirstSliceAngle firstSliceAngle4 = new C.FirstSliceAngle(){ Val = (UInt16Value)0U };

            pieChart4.Append(varyColors7);
            pieChart4.Append(pieChartSeries4);
            pieChart4.Append(dataLabels7);
            pieChart4.Append(firstSliceAngle4);

            plotArea7.Append(layout7);
            plotArea7.Append(pieChart4);

            C.Legend legend7 = new C.Legend();
            C.LegendPosition legendPosition7 = new C.LegendPosition(){ Val = C.LegendPositionValues.Right };
            C.Overlay overlay14 = new C.Overlay(){ Val = false };

            legend7.Append(legendPosition7);
            legend7.Append(overlay14);
            C.PlotVisibleOnly plotVisibleOnly7 = new C.PlotVisibleOnly(){ Val = true };
            C.DisplayBlanksAs displayBlanksAs7 = new C.DisplayBlanksAs(){ Val = C.DisplayBlanksAsValues.Gap };
            C.ShowDataLabelsOverMaximum showDataLabelsOverMaximum7 = new C.ShowDataLabelsOverMaximum(){ Val = false };

            chart7.Append(title7);
            chart7.Append(autoTitleDeleted7);
            chart7.Append(pivotFormats7);
            chart7.Append(plotArea7);
            chart7.Append(legend7);
            chart7.Append(plotVisibleOnly7);
            chart7.Append(displayBlanksAs7);
            chart7.Append(showDataLabelsOverMaximum7);

            C.PrintSettings printSettings7 = new C.PrintSettings();
            C.HeaderFooter headerFooter7 = new C.HeaderFooter();
            C.PageMargins pageMargins13 = new C.PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
            C.PageSetup pageSetup7 = new C.PageSetup();

            printSettings7.Append(headerFooter7);
            printSettings7.Append(pageMargins13);
            printSettings7.Append(pageSetup7);

            C.ChartSpaceExtensionList chartSpaceExtensionList7 = new C.ChartSpaceExtensionList();
            chartSpaceExtensionList7.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            chartSpaceExtensionList7.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            C.ChartSpaceExtension chartSpaceExtension7 = new C.ChartSpaceExtension(){ Uri = "{781A3756-C4B2-4CAC-9D66-4F8BD8637D16}" };
            chartSpaceExtension7.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");

            C14.PivotOptions pivotOptions7 = new C14.PivotOptions();
            C14.DropZoneFilter dropZoneFilter7 = new C14.DropZoneFilter(){ Val = true };
            C14.DropZoneCategories dropZoneCategories7 = new C14.DropZoneCategories(){ Val = true };
            C14.DropZoneData dropZoneData7 = new C14.DropZoneData(){ Val = true };
            C14.DropZoneSeries dropZoneSeries7 = new C14.DropZoneSeries(){ Val = true };
            C14.DropZonesVisible dropZonesVisible7 = new C14.DropZonesVisible(){ Val = true };

            pivotOptions7.Append(dropZoneFilter7);
            pivotOptions7.Append(dropZoneCategories7);
            pivotOptions7.Append(dropZoneData7);
            pivotOptions7.Append(dropZoneSeries7);
            pivotOptions7.Append(dropZonesVisible7);

            chartSpaceExtension7.Append(pivotOptions7);

            chartSpaceExtensionList7.Append(chartSpaceExtension7);

            chartSpace7.Append(date19047);
            chartSpace7.Append(editingLanguage7);
            chartSpace7.Append(roundedCorners7);
            chartSpace7.Append(alternateContent16);
            chartSpace7.Append(pivotSource7);
            chartSpace7.Append(chart7);
            chartSpace7.Append(printSettings7);
            chartSpace7.Append(chartSpaceExtensionList7);

            chartPart7.ChartSpace = chartSpace7;
        }
        // Generates content of chartPart5.
        private void GenerateChartPart5Content(ChartPart chartPart5)
        {
            C.ChartSpace chartSpace5 = new C.ChartSpace();
            chartSpace5.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace5.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace5.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            C.Date1904 date19045 = new C.Date1904(){ Val = false };
            C.EditingLanguage editingLanguage5 = new C.EditingLanguage(){ Val = "en-US" };
            C.RoundedCorners roundedCorners5 = new C.RoundedCorners(){ Val = false };

            AlternateContent alternateContent12 = new AlternateContent();
            alternateContent12.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            AlternateContentChoice alternateContentChoice12 = new AlternateContentChoice(){ Requires = "c14" };
            alternateContentChoice12.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            C14.Style style9 = new C14.Style(){ Val = 102 };

            alternateContentChoice12.Append(style9);

            AlternateContentFallback alternateContentFallback11 = new AlternateContentFallback();
            C.Style style10 = new C.Style(){ Val = 2 };

            alternateContentFallback11.Append(style10);

            alternateContent12.Append(alternateContentChoice12);
            alternateContent12.Append(alternateContentFallback11);

            C.PivotSource pivotSource5 = new C.PivotSource();
            C.PivotTableName pivotTableName5 = new C.PivotTableName();
            pivotTableName5.Text = "[GeneratedDocument.xlsx]ShowSelectionLabel!PivotTable1";
            C.FormatId formatId5 = new C.FormatId(){ Val = (UInt32Value)12U };

            pivotSource5.Append(pivotTableName5);
            pivotSource5.Append(formatId5);

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

            C.Title title5 = new C.Title();
            C.Overlay overlay9 = new C.Overlay(){ Val = false };

            title5.Append(overlay9);
            C.AutoTitleDeleted autoTitleDeleted5 = new C.AutoTitleDeleted(){ Val = false };

            C.PivotFormats pivotFormats5 = new C.PivotFormats();

            C.PivotFormat pivotFormat26 = new C.PivotFormat();
            C.Index index30 = new C.Index(){ Val = (UInt32Value)0U };

            C.Marker marker26 = new C.Marker();
            C.Symbol symbol26 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker26.Append(symbol26);

            pivotFormat26.Append(index30);
            pivotFormat26.Append(marker26);

            C.PivotFormat pivotFormat27 = new C.PivotFormat();
            C.Index index31 = new C.Index(){ Val = (UInt32Value)1U };

            C.Marker marker27 = new C.Marker();
            C.Symbol symbol27 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker27.Append(symbol27);

            pivotFormat27.Append(index31);
            pivotFormat27.Append(marker27);

            C.PivotFormat pivotFormat28 = new C.PivotFormat();
            C.Index index32 = new C.Index(){ Val = (UInt32Value)2U };

            C.Marker marker28 = new C.Marker();
            C.Symbol symbol28 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker28.Append(symbol28);

            pivotFormat28.Append(index32);
            pivotFormat28.Append(marker28);

            C.PivotFormat pivotFormat29 = new C.PivotFormat();
            C.Index index33 = new C.Index(){ Val = (UInt32Value)3U };

            C.Marker marker29 = new C.Marker();
            C.Symbol symbol29 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker29.Append(symbol29);

            pivotFormat29.Append(index33);
            pivotFormat29.Append(marker29);

            pivotFormats5.Append(pivotFormat26);
            pivotFormats5.Append(pivotFormat27);
            pivotFormats5.Append(pivotFormat28);
            pivotFormats5.Append(pivotFormat29);

            C.PlotArea plotArea5 = new C.PlotArea();
            C.Layout layout5 = new C.Layout();

            C.PieChart pieChart3 = new C.PieChart();
            C.VaryColors varyColors5 = new C.VaryColors(){ Val = true };

            C.PieChartSeries pieChartSeries3 = new C.PieChartSeries();
            C.Index index34 = new C.Index(){ Val = (UInt32Value)0U };
            C.Order order5 = new C.Order(){ Val = (UInt32Value)0U };

            C.SeriesText seriesText5 = new C.SeriesText();

            C.StringReference stringReference9 = new C.StringReference();
            C.Formula formula13 = new C.Formula();
            formula13.Text = "ShowSelectionLabel!$B$1";

            C.StringCache stringCache9 = new C.StringCache();
            C.PointCount pointCount13 = new C.PointCount(){ Val = (UInt32Value)1U };

            C.StringPoint stringPoint17 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue29 = new C.NumericValue();
            numericValue29.Text = "Total";

            stringPoint17.Append(numericValue29);

            stringCache9.Append(pointCount13);
            stringCache9.Append(stringPoint17);

            stringReference9.Append(formula13);
            stringReference9.Append(stringCache9);

            seriesText5.Append(stringReference9);

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

            C.StringReference stringReference10 = new C.StringReference();
            C.Formula formula14 = new C.Formula();
            formula14.Text = "ShowSelectionLabel!$A$2:$A$5";

            C.StringCache stringCache10 = new C.StringCache();
            C.PointCount pointCount14 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.StringPoint stringPoint18 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue30 = new C.NumericValue();
            numericValue30.Text = "product_A";

            stringPoint18.Append(numericValue30);

            C.StringPoint stringPoint19 = new C.StringPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue31 = new C.NumericValue();
            numericValue31.Text = "product_D";

            stringPoint19.Append(numericValue31);

            C.StringPoint stringPoint20 = new C.StringPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue32 = new C.NumericValue();
            numericValue32.Text = "product_E";

            stringPoint20.Append(numericValue32);

            stringCache10.Append(pointCount14);
            stringCache10.Append(stringPoint18);
            stringCache10.Append(stringPoint19);
            stringCache10.Append(stringPoint20);

            stringReference10.Append(formula14);
            stringReference10.Append(stringCache10);

            categoryAxisData5.Append(stringReference10);

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

            C.NumberReference numberReference5 = new C.NumberReference();
            C.Formula formula15 = new C.Formula();
            formula15.Text = "ShowSelectionLabel!$B$2:$B$5";

            C.NumberingCache numberingCache5 = new C.NumberingCache();
            C.FormatCode formatCode5 = new C.FormatCode();
            formatCode5.Text = "General";
            C.PointCount pointCount15 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.NumericPoint numericPoint13 = new C.NumericPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue33 = new C.NumericValue();
            numericValue33.Text = "19";

            numericPoint13.Append(numericValue33);

            C.NumericPoint numericPoint14 = new C.NumericPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue34 = new C.NumericValue();
            numericValue34.Text = "13";

            numericPoint14.Append(numericValue34);

            C.NumericPoint numericPoint15 = new C.NumericPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue35 = new C.NumericValue();
            numericValue35.Text = "33";

            numericPoint15.Append(numericValue35);

            numberingCache5.Append(formatCode5);
            numberingCache5.Append(pointCount15);
            numberingCache5.Append(numericPoint13);
            numberingCache5.Append(numericPoint14);
            numberingCache5.Append(numericPoint15);

            numberReference5.Append(formula15);
            numberReference5.Append(numberingCache5);

            values5.Append(numberReference5);

            pieChartSeries3.Append(index34);
            pieChartSeries3.Append(order5);
            pieChartSeries3.Append(seriesText5);
            pieChartSeries3.Append(categoryAxisData5);
            pieChartSeries3.Append(values5);

            C.DataLabels dataLabels5 = new C.DataLabels();
            C.ShowLegendKey showLegendKey5 = new C.ShowLegendKey(){ Val = false };
            C.ShowValue showValue5 = new C.ShowValue(){ Val = false };
            C.ShowCategoryName showCategoryName5 = new C.ShowCategoryName(){ Val = false };
            C.ShowSeriesName showSeriesName5 = new C.ShowSeriesName(){ Val = false };
            C.ShowPercent showPercent5 = new C.ShowPercent(){ Val = false };
            C.ShowBubbleSize showBubbleSize5 = new C.ShowBubbleSize(){ Val = false };
            C.ShowLeaderLines showLeaderLines3 = new C.ShowLeaderLines(){ Val = true };

            dataLabels5.Append(showLegendKey5);
            dataLabels5.Append(showValue5);
            dataLabels5.Append(showCategoryName5);
            dataLabels5.Append(showSeriesName5);
            dataLabels5.Append(showPercent5);
            dataLabels5.Append(showBubbleSize5);
            dataLabels5.Append(showLeaderLines3);
            C.FirstSliceAngle firstSliceAngle3 = new C.FirstSliceAngle(){ Val = (UInt16Value)0U };

            pieChart3.Append(varyColors5);
            pieChart3.Append(pieChartSeries3);
            pieChart3.Append(dataLabels5);
            pieChart3.Append(firstSliceAngle3);

            plotArea5.Append(layout5);
            plotArea5.Append(pieChart3);

            C.Legend legend5 = new C.Legend();
            C.LegendPosition legendPosition5 = new C.LegendPosition(){ Val = C.LegendPositionValues.Right };
            C.Overlay overlay10 = new C.Overlay(){ Val = false };

            legend5.Append(legendPosition5);
            legend5.Append(overlay10);
            C.PlotVisibleOnly plotVisibleOnly5 = new C.PlotVisibleOnly(){ Val = true };
            C.DisplayBlanksAs displayBlanksAs5 = new C.DisplayBlanksAs(){ Val = C.DisplayBlanksAsValues.Gap };
            C.ShowDataLabelsOverMaximum showDataLabelsOverMaximum5 = new C.ShowDataLabelsOverMaximum(){ Val = false };

            chart5.Append(title5);
            chart5.Append(autoTitleDeleted5);
            chart5.Append(pivotFormats5);
            chart5.Append(plotArea5);
            chart5.Append(legend5);
            chart5.Append(plotVisibleOnly5);
            chart5.Append(displayBlanksAs5);
            chart5.Append(showDataLabelsOverMaximum5);

            C.PrintSettings printSettings5 = new C.PrintSettings();
            C.HeaderFooter headerFooter5 = new C.HeaderFooter();
            C.PageMargins pageMargins8 = new C.PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
            C.PageSetup pageSetup5 = new C.PageSetup();

            printSettings5.Append(headerFooter5);
            printSettings5.Append(pageMargins8);
            printSettings5.Append(pageSetup5);

            C.ChartSpaceExtensionList chartSpaceExtensionList5 = new C.ChartSpaceExtensionList();
            chartSpaceExtensionList5.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            chartSpaceExtensionList5.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            C.ChartSpaceExtension chartSpaceExtension5 = new C.ChartSpaceExtension(){ Uri = "{781A3756-C4B2-4CAC-9D66-4F8BD8637D16}" };
            chartSpaceExtension5.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");

            C14.PivotOptions pivotOptions5 = new C14.PivotOptions();
            C14.DropZoneFilter dropZoneFilter5 = new C14.DropZoneFilter(){ Val = true };
            C14.DropZoneCategories dropZoneCategories5 = new C14.DropZoneCategories(){ Val = true };
            C14.DropZoneData dropZoneData5 = new C14.DropZoneData(){ Val = true };
            C14.DropZoneSeries dropZoneSeries5 = new C14.DropZoneSeries(){ Val = true };
            C14.DropZonesVisible dropZonesVisible5 = new C14.DropZonesVisible(){ Val = true };

            pivotOptions5.Append(dropZoneFilter5);
            pivotOptions5.Append(dropZoneCategories5);
            pivotOptions5.Append(dropZoneData5);
            pivotOptions5.Append(dropZoneSeries5);
            pivotOptions5.Append(dropZonesVisible5);

            chartSpaceExtension5.Append(pivotOptions5);

            chartSpaceExtensionList5.Append(chartSpaceExtension5);

            chartSpace5.Append(date19045);
            chartSpace5.Append(editingLanguage5);
            chartSpace5.Append(roundedCorners5);
            chartSpace5.Append(alternateContent12);
            chartSpace5.Append(pivotSource5);
            chartSpace5.Append(chart5);
            chartSpace5.Append(printSettings5);
            chartSpace5.Append(chartSpaceExtensionList5);

            chartPart5.ChartSpace = chartSpace5;
        }
        // Generates content of chartPart3.
        private void GenerateChartPart3Content(ChartPart chartPart3)
        {
            C.ChartSpace chartSpace3 = new C.ChartSpace();
            chartSpace3.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace3.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace3.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            C.Date1904 date19043 = new C.Date1904(){ Val = false };
            C.EditingLanguage editingLanguage3 = new C.EditingLanguage(){ Val = "en-US" };
            C.RoundedCorners roundedCorners3 = new C.RoundedCorners(){ Val = false };

            AlternateContent alternateContent8 = new AlternateContent();
            alternateContent8.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            AlternateContentChoice alternateContentChoice8 = new AlternateContentChoice(){ Requires = "c14" };
            alternateContentChoice8.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            C14.Style style5 = new C14.Style(){ Val = 102 };

            alternateContentChoice8.Append(style5);

            AlternateContentFallback alternateContentFallback7 = new AlternateContentFallback();
            C.Style style6 = new C.Style(){ Val = 2 };

            alternateContentFallback7.Append(style6);

            alternateContent8.Append(alternateContentChoice8);
            alternateContent8.Append(alternateContentFallback7);

            C.PivotSource pivotSource3 = new C.PivotSource();
            C.PivotTableName pivotTableName3 = new C.PivotTableName();
            pivotTableName3.Text = "[GeneratedDocument.xlsx]Cache!PivotTable1";
            C.FormatId formatId3 = new C.FormatId(){ Val = (UInt32Value)1U };

            pivotSource3.Append(pivotTableName3);
            pivotSource3.Append(formatId3);

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

            C.Title title3 = new C.Title();
            C.Overlay overlay5 = new C.Overlay(){ Val = false };

            title3.Append(overlay5);
            C.AutoTitleDeleted autoTitleDeleted3 = new C.AutoTitleDeleted(){ Val = false };

            C.PivotFormats pivotFormats3 = new C.PivotFormats();

            C.PivotFormat pivotFormat24 = new C.PivotFormat();
            C.Index index26 = new C.Index(){ Val = (UInt32Value)0U };

            C.Marker marker24 = new C.Marker();
            C.Symbol symbol24 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker24.Append(symbol24);

            pivotFormat24.Append(index26);
            pivotFormat24.Append(marker24);

            pivotFormats3.Append(pivotFormat24);

            C.PlotArea plotArea3 = new C.PlotArea();
            C.Layout layout3 = new C.Layout();

            C.PieChart pieChart2 = new C.PieChart();
            C.VaryColors varyColors3 = new C.VaryColors(){ Val = true };

            C.PieChartSeries pieChartSeries2 = new C.PieChartSeries();
            C.Index index27 = new C.Index(){ Val = (UInt32Value)0U };
            C.Order order3 = new C.Order(){ Val = (UInt32Value)0U };

            C.SeriesText seriesText3 = new C.SeriesText();

            C.StringReference stringReference5 = new C.StringReference();
            C.Formula formula7 = new C.Formula();
            formula7.Text = "Cache!$B$1";

            C.StringCache stringCache5 = new C.StringCache();
            C.PointCount pointCount7 = new C.PointCount(){ Val = (UInt32Value)1U };

            C.StringPoint stringPoint9 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue15 = new C.NumericValue();
            numericValue15.Text = "Total";

            stringPoint9.Append(numericValue15);

            stringCache5.Append(pointCount7);
            stringCache5.Append(stringPoint9);

            stringReference5.Append(formula7);
            stringReference5.Append(stringCache5);

            seriesText3.Append(stringReference5);

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

            C.StringReference stringReference6 = new C.StringReference();
            C.Formula formula8 = new C.Formula();
            formula8.Text = "Cache!$A$2:$A$5";

            C.StringCache stringCache6 = new C.StringCache();
            C.PointCount pointCount8 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.StringPoint stringPoint10 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue16 = new C.NumericValue();
            numericValue16.Text = "product_C";

            stringPoint10.Append(numericValue16);

            C.StringPoint stringPoint11 = new C.StringPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue17 = new C.NumericValue();
            numericValue17.Text = "product_F";

            stringPoint11.Append(numericValue17);

            C.StringPoint stringPoint12 = new C.StringPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue18 = new C.NumericValue();
            numericValue18.Text = "product_G";

            stringPoint12.Append(numericValue18);

            stringCache6.Append(pointCount8);
            stringCache6.Append(stringPoint10);
            stringCache6.Append(stringPoint11);
            stringCache6.Append(stringPoint12);

            stringReference6.Append(formula8);
            stringReference6.Append(stringCache6);

            categoryAxisData3.Append(stringReference6);

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

            C.NumberReference numberReference3 = new C.NumberReference();
            C.Formula formula9 = new C.Formula();
            formula9.Text = "Cache!$B$2:$B$5";

            C.NumberingCache numberingCache3 = new C.NumberingCache();
            C.FormatCode formatCode3 = new C.FormatCode();
            formatCode3.Text = "General";
            C.PointCount pointCount9 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.NumericPoint numericPoint7 = new C.NumericPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue19 = new C.NumericValue();
            numericValue19.Text = "2050";

            numericPoint7.Append(numericValue19);

            C.NumericPoint numericPoint8 = new C.NumericPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue20 = new C.NumericValue();
            numericValue20.Text = "3168";

            numericPoint8.Append(numericValue20);

            C.NumericPoint numericPoint9 = new C.NumericPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue21 = new C.NumericValue();
            numericValue21.Text = "11529";

            numericPoint9.Append(numericValue21);

            numberingCache3.Append(formatCode3);
            numberingCache3.Append(pointCount9);
            numberingCache3.Append(numericPoint7);
            numberingCache3.Append(numericPoint8);
            numberingCache3.Append(numericPoint9);

            numberReference3.Append(formula9);
            numberReference3.Append(numberingCache3);

            values3.Append(numberReference3);

            pieChartSeries2.Append(index27);
            pieChartSeries2.Append(order3);
            pieChartSeries2.Append(seriesText3);
            pieChartSeries2.Append(categoryAxisData3);
            pieChartSeries2.Append(values3);

            C.DataLabels dataLabels3 = new C.DataLabels();
            C.ShowLegendKey showLegendKey3 = new C.ShowLegendKey(){ Val = false };
            C.ShowValue showValue3 = new C.ShowValue(){ Val = false };
            C.ShowCategoryName showCategoryName3 = new C.ShowCategoryName(){ Val = false };
            C.ShowSeriesName showSeriesName3 = new C.ShowSeriesName(){ Val = false };
            C.ShowPercent showPercent3 = new C.ShowPercent(){ Val = false };
            C.ShowBubbleSize showBubbleSize3 = new C.ShowBubbleSize(){ Val = false };
            C.ShowLeaderLines showLeaderLines2 = new C.ShowLeaderLines(){ Val = true };

            dataLabels3.Append(showLegendKey3);
            dataLabels3.Append(showValue3);
            dataLabels3.Append(showCategoryName3);
            dataLabels3.Append(showSeriesName3);
            dataLabels3.Append(showPercent3);
            dataLabels3.Append(showBubbleSize3);
            dataLabels3.Append(showLeaderLines2);
            C.FirstSliceAngle firstSliceAngle2 = new C.FirstSliceAngle(){ Val = (UInt16Value)0U };

            pieChart2.Append(varyColors3);
            pieChart2.Append(pieChartSeries2);
            pieChart2.Append(dataLabels3);
            pieChart2.Append(firstSliceAngle2);

            plotArea3.Append(layout3);
            plotArea3.Append(pieChart2);

            C.Legend legend3 = new C.Legend();
            C.LegendPosition legendPosition3 = new C.LegendPosition(){ Val = C.LegendPositionValues.Right };
            C.Overlay overlay6 = new C.Overlay(){ Val = false };

            legend3.Append(legendPosition3);
            legend3.Append(overlay6);
            C.PlotVisibleOnly plotVisibleOnly3 = new C.PlotVisibleOnly(){ Val = true };
            C.DisplayBlanksAs displayBlanksAs3 = new C.DisplayBlanksAs(){ Val = C.DisplayBlanksAsValues.Gap };
            C.ShowDataLabelsOverMaximum showDataLabelsOverMaximum3 = new C.ShowDataLabelsOverMaximum(){ Val = false };

            chart3.Append(title3);
            chart3.Append(autoTitleDeleted3);
            chart3.Append(pivotFormats3);
            chart3.Append(plotArea3);
            chart3.Append(legend3);
            chart3.Append(plotVisibleOnly3);
            chart3.Append(displayBlanksAs3);
            chart3.Append(showDataLabelsOverMaximum3);

            C.PrintSettings printSettings3 = new C.PrintSettings();
            C.HeaderFooter headerFooter3 = new C.HeaderFooter();
            C.PageMargins pageMargins5 = new C.PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
            C.PageSetup pageSetup3 = new C.PageSetup();

            printSettings3.Append(headerFooter3);
            printSettings3.Append(pageMargins5);
            printSettings3.Append(pageSetup3);

            C.ChartSpaceExtensionList chartSpaceExtensionList3 = new C.ChartSpaceExtensionList();
            chartSpaceExtensionList3.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            chartSpaceExtensionList3.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            C.ChartSpaceExtension chartSpaceExtension3 = new C.ChartSpaceExtension(){ Uri = "{781A3756-C4B2-4CAC-9D66-4F8BD8637D16}" };
            chartSpaceExtension3.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");

            C14.PivotOptions pivotOptions3 = new C14.PivotOptions();
            C14.DropZoneFilter dropZoneFilter3 = new C14.DropZoneFilter(){ Val = true };
            C14.DropZoneCategories dropZoneCategories3 = new C14.DropZoneCategories(){ Val = true };
            C14.DropZoneData dropZoneData3 = new C14.DropZoneData(){ Val = true };
            C14.DropZoneSeries dropZoneSeries3 = new C14.DropZoneSeries(){ Val = true };
            C14.DropZonesVisible dropZonesVisible3 = new C14.DropZonesVisible(){ Val = true };

            pivotOptions3.Append(dropZoneFilter3);
            pivotOptions3.Append(dropZoneCategories3);
            pivotOptions3.Append(dropZoneData3);
            pivotOptions3.Append(dropZoneSeries3);
            pivotOptions3.Append(dropZonesVisible3);

            chartSpaceExtension3.Append(pivotOptions3);

            chartSpaceExtensionList3.Append(chartSpaceExtension3);

            chartSpace3.Append(date19043);
            chartSpace3.Append(editingLanguage3);
            chartSpace3.Append(roundedCorners3);
            chartSpace3.Append(alternateContent8);
            chartSpace3.Append(pivotSource3);
            chartSpace3.Append(chart3);
            chartSpace3.Append(printSettings3);
            chartSpace3.Append(chartSpaceExtensionList3);

            chartPart3.ChartSpace = chartSpace3;
        }
        // Generates content of chartPart17.
        private void GenerateChartPart17Content(ChartPart chartPart17)
        {
            C.ChartSpace chartSpace17 = new C.ChartSpace();
            chartSpace17.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace17.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace17.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            C.Date1904 date190417 = new C.Date1904(){ Val = false };
            C.EditingLanguage editingLanguage17 = new C.EditingLanguage(){ Val = "en-US" };
            C.RoundedCorners roundedCorners17 = new C.RoundedCorners(){ Val = false };

            AlternateContent alternateContent37 = new AlternateContent();
            alternateContent37.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            AlternateContentChoice alternateContentChoice37 = new AlternateContentChoice(){ Requires = "c14" };
            alternateContentChoice37.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            C14.Style style32 = new C14.Style(){ Val = 102 };

            alternateContentChoice37.Append(style32);

            AlternateContentFallback alternateContentFallback36 = new AlternateContentFallback();
            C.Style style33 = new C.Style(){ Val = 2 };

            alternateContentFallback36.Append(style33);

            alternateContent37.Append(alternateContentChoice37);
            alternateContent37.Append(alternateContentFallback36);

            C.PivotSource pivotSource17 = new C.PivotSource();
            C.PivotTableName pivotTableName17 = new C.PivotTableName();
            pivotTableName17.Text = "[GeneratedDocument.xlsx]ShowHorizontalScrollbar!PivotTable1";
            C.FormatId formatId17 = new C.FormatId(){ Val = (UInt32Value)16U };

            pivotSource17.Append(pivotTableName17);
            pivotSource17.Append(formatId17);

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

            C.Title title17 = new C.Title();
            C.Overlay overlay33 = new C.Overlay(){ Val = false };

            title17.Append(overlay33);
            C.AutoTitleDeleted autoTitleDeleted17 = new C.AutoTitleDeleted(){ Val = false };

            C.PivotFormats pivotFormats17 = new C.PivotFormats();

            C.PivotFormat pivotFormat154 = new C.PivotFormat();
            C.Index index170 = new C.Index(){ Val = (UInt32Value)0U };

            C.Marker marker154 = new C.Marker();
            C.Symbol symbol154 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker154.Append(symbol154);

            pivotFormat154.Append(index170);
            pivotFormat154.Append(marker154);

            C.PivotFormat pivotFormat155 = new C.PivotFormat();
            C.Index index171 = new C.Index(){ Val = (UInt32Value)1U };

            C.Marker marker155 = new C.Marker();
            C.Symbol symbol155 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker155.Append(symbol155);

            pivotFormat155.Append(index171);
            pivotFormat155.Append(marker155);

            C.PivotFormat pivotFormat156 = new C.PivotFormat();
            C.Index index172 = new C.Index(){ Val = (UInt32Value)2U };

            C.Marker marker156 = new C.Marker();
            C.Symbol symbol156 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker156.Append(symbol156);

            pivotFormat156.Append(index172);
            pivotFormat156.Append(marker156);

            C.PivotFormat pivotFormat157 = new C.PivotFormat();
            C.Index index173 = new C.Index(){ Val = (UInt32Value)3U };

            C.Marker marker157 = new C.Marker();
            C.Symbol symbol157 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker157.Append(symbol157);

            pivotFormat157.Append(index173);
            pivotFormat157.Append(marker157);

            C.PivotFormat pivotFormat158 = new C.PivotFormat();
            C.Index index174 = new C.Index(){ Val = (UInt32Value)4U };

            C.Marker marker158 = new C.Marker();
            C.Symbol symbol158 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker158.Append(symbol158);

            pivotFormat158.Append(index174);
            pivotFormat158.Append(marker158);

            C.PivotFormat pivotFormat159 = new C.PivotFormat();
            C.Index index175 = new C.Index(){ Val = (UInt32Value)5U };

            C.Marker marker159 = new C.Marker();
            C.Symbol symbol159 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker159.Append(symbol159);

            pivotFormat159.Append(index175);
            pivotFormat159.Append(marker159);

            pivotFormats17.Append(pivotFormat154);
            pivotFormats17.Append(pivotFormat155);
            pivotFormats17.Append(pivotFormat156);
            pivotFormats17.Append(pivotFormat157);
            pivotFormats17.Append(pivotFormat158);
            pivotFormats17.Append(pivotFormat159);

            C.PlotArea plotArea17 = new C.PlotArea();
            C.Layout layout17 = new C.Layout();

            C.PieChart pieChart9 = new C.PieChart();
            C.VaryColors varyColors17 = new C.VaryColors(){ Val = true };

            C.PieChartSeries pieChartSeries9 = new C.PieChartSeries();
            C.Index index176 = new C.Index(){ Val = (UInt32Value)0U };
            C.Order order17 = new C.Order(){ Val = (UInt32Value)0U };

            C.SeriesText seriesText17 = new C.SeriesText();

            C.StringReference stringReference33 = new C.StringReference();
            C.Formula formula49 = new C.Formula();
            formula49.Text = "ShowHorizontalScrollbar!$B$1";

            C.StringCache stringCache33 = new C.StringCache();
            C.PointCount pointCount49 = new C.PointCount(){ Val = (UInt32Value)1U };

            C.StringPoint stringPoint65 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue113 = new C.NumericValue();
            numericValue113.Text = "Total";

            stringPoint65.Append(numericValue113);

            stringCache33.Append(pointCount49);
            stringCache33.Append(stringPoint65);

            stringReference33.Append(formula49);
            stringReference33.Append(stringCache33);

            seriesText17.Append(stringReference33);

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

            C.StringReference stringReference34 = new C.StringReference();
            C.Formula formula50 = new C.Formula();
            formula50.Text = "ShowHorizontalScrollbar!$A$2:$A$5";

            C.StringCache stringCache34 = new C.StringCache();
            C.PointCount pointCount50 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.StringPoint stringPoint66 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue114 = new C.NumericValue();
            numericValue114.Text = "product_A";

            stringPoint66.Append(numericValue114);

            C.StringPoint stringPoint67 = new C.StringPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue115 = new C.NumericValue();
            numericValue115.Text = "product_D";

            stringPoint67.Append(numericValue115);

            C.StringPoint stringPoint68 = new C.StringPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue116 = new C.NumericValue();
            numericValue116.Text = "product_E";

            stringPoint68.Append(numericValue116);

            stringCache34.Append(pointCount50);
            stringCache34.Append(stringPoint66);
            stringCache34.Append(stringPoint67);
            stringCache34.Append(stringPoint68);

            stringReference34.Append(formula50);
            stringReference34.Append(stringCache34);

            categoryAxisData17.Append(stringReference34);

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

            C.NumberReference numberReference17 = new C.NumberReference();
            C.Formula formula51 = new C.Formula();
            formula51.Text = "ShowHorizontalScrollbar!$B$2:$B$5";

            C.NumberingCache numberingCache17 = new C.NumberingCache();
            C.FormatCode formatCode17 = new C.FormatCode();
            formatCode17.Text = "General";
            C.PointCount pointCount51 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.NumericPoint numericPoint49 = new C.NumericPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue117 = new C.NumericValue();
            numericValue117.Text = "19";

            numericPoint49.Append(numericValue117);

            C.NumericPoint numericPoint50 = new C.NumericPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue118 = new C.NumericValue();
            numericValue118.Text = "13";

            numericPoint50.Append(numericValue118);

            C.NumericPoint numericPoint51 = new C.NumericPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue119 = new C.NumericValue();
            numericValue119.Text = "33";

            numericPoint51.Append(numericValue119);

            numberingCache17.Append(formatCode17);
            numberingCache17.Append(pointCount51);
            numberingCache17.Append(numericPoint49);
            numberingCache17.Append(numericPoint50);
            numberingCache17.Append(numericPoint51);

            numberReference17.Append(formula51);
            numberReference17.Append(numberingCache17);

            values17.Append(numberReference17);

            pieChartSeries9.Append(index176);
            pieChartSeries9.Append(order17);
            pieChartSeries9.Append(seriesText17);
            pieChartSeries9.Append(categoryAxisData17);
            pieChartSeries9.Append(values17);

            C.DataLabels dataLabels17 = new C.DataLabels();
            C.ShowLegendKey showLegendKey17 = new C.ShowLegendKey(){ Val = false };
            C.ShowValue showValue17 = new C.ShowValue(){ Val = false };
            C.ShowCategoryName showCategoryName17 = new C.ShowCategoryName(){ Val = false };
            C.ShowSeriesName showSeriesName17 = new C.ShowSeriesName(){ Val = false };
            C.ShowPercent showPercent17 = new C.ShowPercent(){ Val = false };
            C.ShowBubbleSize showBubbleSize17 = new C.ShowBubbleSize(){ Val = false };
            C.ShowLeaderLines showLeaderLines9 = new C.ShowLeaderLines(){ Val = true };

            dataLabels17.Append(showLegendKey17);
            dataLabels17.Append(showValue17);
            dataLabels17.Append(showCategoryName17);
            dataLabels17.Append(showSeriesName17);
            dataLabels17.Append(showPercent17);
            dataLabels17.Append(showBubbleSize17);
            dataLabels17.Append(showLeaderLines9);
            C.FirstSliceAngle firstSliceAngle9 = new C.FirstSliceAngle(){ Val = (UInt16Value)0U };

            pieChart9.Append(varyColors17);
            pieChart9.Append(pieChartSeries9);
            pieChart9.Append(dataLabels17);
            pieChart9.Append(firstSliceAngle9);

            plotArea17.Append(layout17);
            plotArea17.Append(pieChart9);

            C.Legend legend17 = new C.Legend();
            C.LegendPosition legendPosition17 = new C.LegendPosition(){ Val = C.LegendPositionValues.Right };
            C.Overlay overlay34 = new C.Overlay(){ Val = false };

            legend17.Append(legendPosition17);
            legend17.Append(overlay34);
            C.PlotVisibleOnly plotVisibleOnly17 = new C.PlotVisibleOnly(){ Val = true };
            C.DisplayBlanksAs displayBlanksAs17 = new C.DisplayBlanksAs(){ Val = C.DisplayBlanksAsValues.Gap };
            C.ShowDataLabelsOverMaximum showDataLabelsOverMaximum17 = new C.ShowDataLabelsOverMaximum(){ Val = false };

            chart17.Append(title17);
            chart17.Append(autoTitleDeleted17);
            chart17.Append(pivotFormats17);
            chart17.Append(plotArea17);
            chart17.Append(legend17);
            chart17.Append(plotVisibleOnly17);
            chart17.Append(displayBlanksAs17);
            chart17.Append(showDataLabelsOverMaximum17);

            C.PrintSettings printSettings17 = new C.PrintSettings();
            C.HeaderFooter headerFooter17 = new C.HeaderFooter();
            C.PageMargins pageMargins28 = new C.PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
            C.PageSetup pageSetup17 = new C.PageSetup();

            printSettings17.Append(headerFooter17);
            printSettings17.Append(pageMargins28);
            printSettings17.Append(pageSetup17);

            C.ChartSpaceExtensionList chartSpaceExtensionList17 = new C.ChartSpaceExtensionList();
            chartSpaceExtensionList17.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            chartSpaceExtensionList17.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            C.ChartSpaceExtension chartSpaceExtension17 = new C.ChartSpaceExtension(){ Uri = "{781A3756-C4B2-4CAC-9D66-4F8BD8637D16}" };
            chartSpaceExtension17.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");

            C14.PivotOptions pivotOptions17 = new C14.PivotOptions();
            C14.DropZoneFilter dropZoneFilter17 = new C14.DropZoneFilter(){ Val = true };
            C14.DropZoneCategories dropZoneCategories17 = new C14.DropZoneCategories(){ Val = true };
            C14.DropZoneData dropZoneData17 = new C14.DropZoneData(){ Val = true };
            C14.DropZoneSeries dropZoneSeries17 = new C14.DropZoneSeries(){ Val = true };
            C14.DropZonesVisible dropZonesVisible17 = new C14.DropZonesVisible(){ Val = true };

            pivotOptions17.Append(dropZoneFilter17);
            pivotOptions17.Append(dropZoneCategories17);
            pivotOptions17.Append(dropZoneData17);
            pivotOptions17.Append(dropZoneSeries17);
            pivotOptions17.Append(dropZonesVisible17);

            chartSpaceExtension17.Append(pivotOptions17);

            chartSpaceExtensionList17.Append(chartSpaceExtension17);

            chartSpace17.Append(date190417);
            chartSpace17.Append(editingLanguage17);
            chartSpace17.Append(roundedCorners17);
            chartSpace17.Append(alternateContent37);
            chartSpace17.Append(pivotSource17);
            chartSpace17.Append(chart17);
            chartSpace17.Append(printSettings17);
            chartSpace17.Append(chartSpaceExtensionList17);

            chartPart17.ChartSpace = chartSpace17;
        }
        // Generates content of chartPart11.
        private void GenerateChartPart11Content(ChartPart chartPart11)
        {
            C.ChartSpace chartSpace11 = new C.ChartSpace();
            chartSpace11.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace11.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace11.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            C.Date1904 date190411 = new C.Date1904(){ Val = false };
            C.EditingLanguage editingLanguage11 = new C.EditingLanguage(){ Val = "en-US" };
            C.RoundedCorners roundedCorners11 = new C.RoundedCorners(){ Val = false };

            AlternateContent alternateContent24 = new AlternateContent();
            alternateContent24.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            AlternateContentChoice alternateContentChoice24 = new AlternateContentChoice(){ Requires = "c14" };
            alternateContentChoice24.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            C14.Style style21 = new C14.Style(){ Val = 102 };

            alternateContentChoice24.Append(style21);

            AlternateContentFallback alternateContentFallback23 = new AlternateContentFallback();
            C.Style style22 = new C.Style(){ Val = 2 };

            alternateContentFallback23.Append(style22);

            alternateContent24.Append(alternateContentChoice24);
            alternateContent24.Append(alternateContentFallback23);

            C.PivotSource pivotSource11 = new C.PivotSource();
            C.PivotTableName pivotTableName11 = new C.PivotTableName();
            pivotTableName11.Text = "[GeneratedDocument.xlsx]Caption!PivotTable1";
            C.FormatId formatId11 = new C.FormatId(){ Val = (UInt32Value)8U };

            pivotSource11.Append(pivotTableName11);
            pivotSource11.Append(formatId11);

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

            C.Title title11 = new C.Title();
            C.Overlay overlay21 = new C.Overlay(){ Val = false };

            title11.Append(overlay21);
            C.AutoTitleDeleted autoTitleDeleted11 = new C.AutoTitleDeleted(){ Val = false };

            C.PivotFormats pivotFormats11 = new C.PivotFormats();

            C.PivotFormat pivotFormat95 = new C.PivotFormat();
            C.Index index105 = new C.Index(){ Val = (UInt32Value)0U };

            C.Marker marker95 = new C.Marker();
            C.Symbol symbol95 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker95.Append(symbol95);

            pivotFormat95.Append(index105);
            pivotFormat95.Append(marker95);

            C.PivotFormat pivotFormat96 = new C.PivotFormat();
            C.Index index106 = new C.Index(){ Val = (UInt32Value)1U };

            C.Marker marker96 = new C.Marker();
            C.Symbol symbol96 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker96.Append(symbol96);

            pivotFormat96.Append(index106);
            pivotFormat96.Append(marker96);

            pivotFormats11.Append(pivotFormat95);
            pivotFormats11.Append(pivotFormat96);

            C.PlotArea plotArea11 = new C.PlotArea();
            C.Layout layout11 = new C.Layout();

            C.PieChart pieChart6 = new C.PieChart();
            C.VaryColors varyColors11 = new C.VaryColors(){ Val = true };

            C.PieChartSeries pieChartSeries6 = new C.PieChartSeries();
            C.Index index107 = new C.Index(){ Val = (UInt32Value)0U };
            C.Order order11 = new C.Order(){ Val = (UInt32Value)0U };

            C.SeriesText seriesText11 = new C.SeriesText();

            C.StringReference stringReference21 = new C.StringReference();
            C.Formula formula31 = new C.Formula();
            formula31.Text = "Caption!$B$1";

            C.StringCache stringCache21 = new C.StringCache();
            C.PointCount pointCount31 = new C.PointCount(){ Val = (UInt32Value)1U };

            C.StringPoint stringPoint41 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue71 = new C.NumericValue();
            numericValue71.Text = "Total";

            stringPoint41.Append(numericValue71);

            stringCache21.Append(pointCount31);
            stringCache21.Append(stringPoint41);

            stringReference21.Append(formula31);
            stringReference21.Append(stringCache21);

            seriesText11.Append(stringReference21);

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

            C.StringReference stringReference22 = new C.StringReference();
            C.Formula formula32 = new C.Formula();
            formula32.Text = "Caption!$A$2:$A$5";

            C.StringCache stringCache22 = new C.StringCache();
            C.PointCount pointCount32 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.StringPoint stringPoint42 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue72 = new C.NumericValue();
            numericValue72.Text = "product_A";

            stringPoint42.Append(numericValue72);

            C.StringPoint stringPoint43 = new C.StringPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue73 = new C.NumericValue();
            numericValue73.Text = "product_D";

            stringPoint43.Append(numericValue73);

            C.StringPoint stringPoint44 = new C.StringPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue74 = new C.NumericValue();
            numericValue74.Text = "product_E";

            stringPoint44.Append(numericValue74);

            stringCache22.Append(pointCount32);
            stringCache22.Append(stringPoint42);
            stringCache22.Append(stringPoint43);
            stringCache22.Append(stringPoint44);

            stringReference22.Append(formula32);
            stringReference22.Append(stringCache22);

            categoryAxisData11.Append(stringReference22);

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

            C.NumberReference numberReference11 = new C.NumberReference();
            C.Formula formula33 = new C.Formula();
            formula33.Text = "Caption!$B$2:$B$5";

            C.NumberingCache numberingCache11 = new C.NumberingCache();
            C.FormatCode formatCode11 = new C.FormatCode();
            formatCode11.Text = "General";
            C.PointCount pointCount33 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.NumericPoint numericPoint31 = new C.NumericPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue75 = new C.NumericValue();
            numericValue75.Text = "19";

            numericPoint31.Append(numericValue75);

            C.NumericPoint numericPoint32 = new C.NumericPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue76 = new C.NumericValue();
            numericValue76.Text = "13";

            numericPoint32.Append(numericValue76);

            C.NumericPoint numericPoint33 = new C.NumericPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue77 = new C.NumericValue();
            numericValue77.Text = "33";

            numericPoint33.Append(numericValue77);

            numberingCache11.Append(formatCode11);
            numberingCache11.Append(pointCount33);
            numberingCache11.Append(numericPoint31);
            numberingCache11.Append(numericPoint32);
            numberingCache11.Append(numericPoint33);

            numberReference11.Append(formula33);
            numberReference11.Append(numberingCache11);

            values11.Append(numberReference11);

            pieChartSeries6.Append(index107);
            pieChartSeries6.Append(order11);
            pieChartSeries6.Append(seriesText11);
            pieChartSeries6.Append(categoryAxisData11);
            pieChartSeries6.Append(values11);

            C.DataLabels dataLabels11 = new C.DataLabels();
            C.ShowLegendKey showLegendKey11 = new C.ShowLegendKey(){ Val = false };
            C.ShowValue showValue11 = new C.ShowValue(){ Val = false };
            C.ShowCategoryName showCategoryName11 = new C.ShowCategoryName(){ Val = false };
            C.ShowSeriesName showSeriesName11 = new C.ShowSeriesName(){ Val = false };
            C.ShowPercent showPercent11 = new C.ShowPercent(){ Val = false };
            C.ShowBubbleSize showBubbleSize11 = new C.ShowBubbleSize(){ Val = false };
            C.ShowLeaderLines showLeaderLines6 = new C.ShowLeaderLines(){ Val = true };

            dataLabels11.Append(showLegendKey11);
            dataLabels11.Append(showValue11);
            dataLabels11.Append(showCategoryName11);
            dataLabels11.Append(showSeriesName11);
            dataLabels11.Append(showPercent11);
            dataLabels11.Append(showBubbleSize11);
            dataLabels11.Append(showLeaderLines6);
            C.FirstSliceAngle firstSliceAngle6 = new C.FirstSliceAngle(){ Val = (UInt16Value)0U };

            pieChart6.Append(varyColors11);
            pieChart6.Append(pieChartSeries6);
            pieChart6.Append(dataLabels11);
            pieChart6.Append(firstSliceAngle6);

            plotArea11.Append(layout11);
            plotArea11.Append(pieChart6);

            C.Legend legend11 = new C.Legend();
            C.LegendPosition legendPosition11 = new C.LegendPosition(){ Val = C.LegendPositionValues.Right };
            C.Overlay overlay22 = new C.Overlay(){ Val = false };

            legend11.Append(legendPosition11);
            legend11.Append(overlay22);
            C.PlotVisibleOnly plotVisibleOnly11 = new C.PlotVisibleOnly(){ Val = true };
            C.DisplayBlanksAs displayBlanksAs11 = new C.DisplayBlanksAs(){ Val = C.DisplayBlanksAsValues.Gap };
            C.ShowDataLabelsOverMaximum showDataLabelsOverMaximum11 = new C.ShowDataLabelsOverMaximum(){ Val = false };

            chart11.Append(title11);
            chart11.Append(autoTitleDeleted11);
            chart11.Append(pivotFormats11);
            chart11.Append(plotArea11);
            chart11.Append(legend11);
            chart11.Append(plotVisibleOnly11);
            chart11.Append(displayBlanksAs11);
            chart11.Append(showDataLabelsOverMaximum11);

            C.PrintSettings printSettings11 = new C.PrintSettings();
            C.HeaderFooter headerFooter11 = new C.HeaderFooter();
            C.PageMargins pageMargins19 = new C.PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
            C.PageSetup pageSetup11 = new C.PageSetup();

            printSettings11.Append(headerFooter11);
            printSettings11.Append(pageMargins19);
            printSettings11.Append(pageSetup11);

            C.ChartSpaceExtensionList chartSpaceExtensionList11 = new C.ChartSpaceExtensionList();
            chartSpaceExtensionList11.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            chartSpaceExtensionList11.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            C.ChartSpaceExtension chartSpaceExtension11 = new C.ChartSpaceExtension(){ Uri = "{781A3756-C4B2-4CAC-9D66-4F8BD8637D16}" };
            chartSpaceExtension11.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");

            C14.PivotOptions pivotOptions11 = new C14.PivotOptions();
            C14.DropZoneFilter dropZoneFilter11 = new C14.DropZoneFilter(){ Val = true };
            C14.DropZoneCategories dropZoneCategories11 = new C14.DropZoneCategories(){ Val = true };
            C14.DropZoneData dropZoneData11 = new C14.DropZoneData(){ Val = true };
            C14.DropZoneSeries dropZoneSeries11 = new C14.DropZoneSeries(){ Val = true };
            C14.DropZonesVisible dropZonesVisible11 = new C14.DropZonesVisible(){ Val = true };

            pivotOptions11.Append(dropZoneFilter11);
            pivotOptions11.Append(dropZoneCategories11);
            pivotOptions11.Append(dropZoneData11);
            pivotOptions11.Append(dropZoneSeries11);
            pivotOptions11.Append(dropZonesVisible11);

            chartSpaceExtension11.Append(pivotOptions11);

            chartSpaceExtensionList11.Append(chartSpaceExtension11);

            chartSpace11.Append(date190411);
            chartSpace11.Append(editingLanguage11);
            chartSpace11.Append(roundedCorners11);
            chartSpace11.Append(alternateContent24);
            chartSpace11.Append(pivotSource11);
            chartSpace11.Append(chart11);
            chartSpace11.Append(printSettings11);
            chartSpace11.Append(chartSpaceExtensionList11);

            chartPart11.ChartSpace = chartSpace11;
        }
        // Generates content of chartPart9.
        private void GenerateChartPart9Content(ChartPart chartPart9)
        {
            C.ChartSpace chartSpace9 = new C.ChartSpace();
            chartSpace9.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace9.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace9.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            C.Date1904 date19049 = new C.Date1904(){ Val = false };
            C.EditingLanguage editingLanguage9 = new C.EditingLanguage(){ Val = "en-US" };
            C.RoundedCorners roundedCorners9 = new C.RoundedCorners(){ Val = false };

            AlternateContent alternateContent20 = new AlternateContent();
            alternateContent20.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            AlternateContentChoice alternateContentChoice20 = new AlternateContentChoice(){ Requires = "c14" };
            alternateContentChoice20.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            C14.Style style17 = new C14.Style(){ Val = 102 };

            alternateContentChoice20.Append(style17);

            AlternateContentFallback alternateContentFallback19 = new AlternateContentFallback();
            C.Style style18 = new C.Style(){ Val = 2 };

            alternateContentFallback19.Append(style18);

            alternateContent20.Append(alternateContentChoice20);
            alternateContent20.Append(alternateContentFallback19);

            C.PivotSource pivotSource9 = new C.PivotSource();
            C.PivotTableName pivotTableName9 = new C.PivotTableName();
            pivotTableName9.Text = "[GeneratedDocument.xlsx]Style!PivotTable1";
            C.FormatId formatId9 = new C.FormatId(){ Val = (UInt32Value)20U };

            pivotSource9.Append(pivotTableName9);
            pivotSource9.Append(formatId9);

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

            C.Title title9 = new C.Title();
            C.Overlay overlay17 = new C.Overlay(){ Val = false };

            title9.Append(overlay17);
            C.AutoTitleDeleted autoTitleDeleted9 = new C.AutoTitleDeleted(){ Val = false };

            C.PivotFormats pivotFormats9 = new C.PivotFormats();

            C.PivotFormat pivotFormat66 = new C.PivotFormat();
            C.Index index74 = new C.Index(){ Val = (UInt32Value)0U };

            C.Marker marker66 = new C.Marker();
            C.Symbol symbol66 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker66.Append(symbol66);

            pivotFormat66.Append(index74);
            pivotFormat66.Append(marker66);

            C.PivotFormat pivotFormat67 = new C.PivotFormat();
            C.Index index75 = new C.Index(){ Val = (UInt32Value)1U };

            C.Marker marker67 = new C.Marker();
            C.Symbol symbol67 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker67.Append(symbol67);

            pivotFormat67.Append(index75);
            pivotFormat67.Append(marker67);

            C.PivotFormat pivotFormat68 = new C.PivotFormat();
            C.Index index76 = new C.Index(){ Val = (UInt32Value)2U };

            C.Marker marker68 = new C.Marker();
            C.Symbol symbol68 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker68.Append(symbol68);

            pivotFormat68.Append(index76);
            pivotFormat68.Append(marker68);

            C.PivotFormat pivotFormat69 = new C.PivotFormat();
            C.Index index77 = new C.Index(){ Val = (UInt32Value)3U };

            C.Marker marker69 = new C.Marker();
            C.Symbol symbol69 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker69.Append(symbol69);

            pivotFormat69.Append(index77);
            pivotFormat69.Append(marker69);

            C.PivotFormat pivotFormat70 = new C.PivotFormat();
            C.Index index78 = new C.Index(){ Val = (UInt32Value)4U };

            C.Marker marker70 = new C.Marker();
            C.Symbol symbol70 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker70.Append(symbol70);

            pivotFormat70.Append(index78);
            pivotFormat70.Append(marker70);

            C.PivotFormat pivotFormat71 = new C.PivotFormat();
            C.Index index79 = new C.Index(){ Val = (UInt32Value)5U };

            C.Marker marker71 = new C.Marker();
            C.Symbol symbol71 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker71.Append(symbol71);

            pivotFormat71.Append(index79);
            pivotFormat71.Append(marker71);

            C.PivotFormat pivotFormat72 = new C.PivotFormat();
            C.Index index80 = new C.Index(){ Val = (UInt32Value)6U };

            C.Marker marker72 = new C.Marker();
            C.Symbol symbol72 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker72.Append(symbol72);

            pivotFormat72.Append(index80);
            pivotFormat72.Append(marker72);

            C.PivotFormat pivotFormat73 = new C.PivotFormat();
            C.Index index81 = new C.Index(){ Val = (UInt32Value)7U };

            C.Marker marker73 = new C.Marker();
            C.Symbol symbol73 = new C.Symbol(){ Val = C.MarkerStyleValues.None };

            marker73.Append(symbol73);

            pivotFormat73.Append(index81);
            pivotFormat73.Append(marker73);

            pivotFormats9.Append(pivotFormat66);
            pivotFormats9.Append(pivotFormat67);
            pivotFormats9.Append(pivotFormat68);
            pivotFormats9.Append(pivotFormat69);
            pivotFormats9.Append(pivotFormat70);
            pivotFormats9.Append(pivotFormat71);
            pivotFormats9.Append(pivotFormat72);
            pivotFormats9.Append(pivotFormat73);

            C.PlotArea plotArea9 = new C.PlotArea();
            C.Layout layout9 = new C.Layout();

            C.PieChart pieChart5 = new C.PieChart();
            C.VaryColors varyColors9 = new C.VaryColors(){ Val = true };

            C.PieChartSeries pieChartSeries5 = new C.PieChartSeries();
            C.Index index82 = new C.Index(){ Val = (UInt32Value)0U };
            C.Order order9 = new C.Order(){ Val = (UInt32Value)0U };

            C.SeriesText seriesText9 = new C.SeriesText();

            C.StringReference stringReference17 = new C.StringReference();
            C.Formula formula25 = new C.Formula();
            formula25.Text = "Style!$B$1";

            C.StringCache stringCache17 = new C.StringCache();
            C.PointCount pointCount25 = new C.PointCount(){ Val = (UInt32Value)1U };

            C.StringPoint stringPoint33 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue57 = new C.NumericValue();
            numericValue57.Text = "Total";

            stringPoint33.Append(numericValue57);

            stringCache17.Append(pointCount25);
            stringCache17.Append(stringPoint33);

            stringReference17.Append(formula25);
            stringReference17.Append(stringCache17);

            seriesText9.Append(stringReference17);

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

            C.StringReference stringReference18 = new C.StringReference();
            C.Formula formula26 = new C.Formula();
            formula26.Text = "Style!$A$2:$A$5";

            C.StringCache stringCache18 = new C.StringCache();
            C.PointCount pointCount26 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.StringPoint stringPoint34 = new C.StringPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue58 = new C.NumericValue();
            numericValue58.Text = "product_A";

            stringPoint34.Append(numericValue58);

            C.StringPoint stringPoint35 = new C.StringPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue59 = new C.NumericValue();
            numericValue59.Text = "product_D";

            stringPoint35.Append(numericValue59);

            C.StringPoint stringPoint36 = new C.StringPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue60 = new C.NumericValue();
            numericValue60.Text = "product_E";

            stringPoint36.Append(numericValue60);

            stringCache18.Append(pointCount26);
            stringCache18.Append(stringPoint34);
            stringCache18.Append(stringPoint35);
            stringCache18.Append(stringPoint36);

            stringReference18.Append(formula26);
            stringReference18.Append(stringCache18);

            categoryAxisData9.Append(stringReference18);

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

            C.NumberReference numberReference9 = new C.NumberReference();
            C.Formula formula27 = new C.Formula();
            formula27.Text = "Style!$B$2:$B$5";

            C.NumberingCache numberingCache9 = new C.NumberingCache();
            C.FormatCode formatCode9 = new C.FormatCode();
            formatCode9.Text = "General";
            C.PointCount pointCount27 = new C.PointCount(){ Val = (UInt32Value)3U };

            C.NumericPoint numericPoint25 = new C.NumericPoint(){ Index = (UInt32Value)0U };
            C.NumericValue numericValue61 = new C.NumericValue();
            numericValue61.Text = "19";

            numericPoint25.Append(numericValue61);

            C.NumericPoint numericPoint26 = new C.NumericPoint(){ Index = (UInt32Value)1U };
            C.NumericValue numericValue62 = new C.NumericValue();
            numericValue62.Text = "13";

            numericPoint26.Append(numericValue62);

            C.NumericPoint numericPoint27 = new C.NumericPoint(){ Index = (UInt32Value)2U };
            C.NumericValue numericValue63 = new C.NumericValue();
            numericValue63.Text = "33";

            numericPoint27.Append(numericValue63);

            numberingCache9.Append(formatCode9);
            numberingCache9.Append(pointCount27);
            numberingCache9.Append(numericPoint25);
            numberingCache9.Append(numericPoint26);
            numberingCache9.Append(numericPoint27);

            numberReference9.Append(formula27);
            numberReference9.Append(numberingCache9);

            values9.Append(numberReference9);

            pieChartSeries5.Append(index82);
            pieChartSeries5.Append(order9);
            pieChartSeries5.Append(seriesText9);
            pieChartSeries5.Append(categoryAxisData9);
            pieChartSeries5.Append(values9);

            C.DataLabels dataLabels9 = new C.DataLabels();
            C.ShowLegendKey showLegendKey9 = new C.ShowLegendKey(){ Val = false };
            C.ShowValue showValue9 = new C.ShowValue(){ Val = false };
            C.ShowCategoryName showCategoryName9 = new C.ShowCategoryName(){ Val = false };
            C.ShowSeriesName showSeriesName9 = new C.ShowSeriesName(){ Val = false };
            C.ShowPercent showPercent9 = new C.ShowPercent(){ Val = false };
            C.ShowBubbleSize showBubbleSize9 = new C.ShowBubbleSize(){ Val = false };
            C.ShowLeaderLines showLeaderLines5 = new C.ShowLeaderLines(){ Val = true };

            dataLabels9.Append(showLegendKey9);
            dataLabels9.Append(showValue9);
            dataLabels9.Append(showCategoryName9);
            dataLabels9.Append(showSeriesName9);
            dataLabels9.Append(showPercent9);
            dataLabels9.Append(showBubbleSize9);
            dataLabels9.Append(showLeaderLines5);
            C.FirstSliceAngle firstSliceAngle5 = new C.FirstSliceAngle(){ Val = (UInt16Value)0U };

            pieChart5.Append(varyColors9);
            pieChart5.Append(pieChartSeries5);
            pieChart5.Append(dataLabels9);
            pieChart5.Append(firstSliceAngle5);

            plotArea9.Append(layout9);
            plotArea9.Append(pieChart5);

            C.Legend legend9 = new C.Legend();
            C.LegendPosition legendPosition9 = new C.LegendPosition(){ Val = C.LegendPositionValues.Right };
            C.Overlay overlay18 = new C.Overlay(){ Val = false };

            legend9.Append(legendPosition9);
            legend9.Append(overlay18);
            C.PlotVisibleOnly plotVisibleOnly9 = new C.PlotVisibleOnly(){ Val = true };
            C.DisplayBlanksAs displayBlanksAs9 = new C.DisplayBlanksAs(){ Val = C.DisplayBlanksAsValues.Gap };
            C.ShowDataLabelsOverMaximum showDataLabelsOverMaximum9 = new C.ShowDataLabelsOverMaximum(){ Val = false };

            chart9.Append(title9);
            chart9.Append(autoTitleDeleted9);
            chart9.Append(pivotFormats9);
            chart9.Append(plotArea9);
            chart9.Append(legend9);
            chart9.Append(plotVisibleOnly9);
            chart9.Append(displayBlanksAs9);
            chart9.Append(showDataLabelsOverMaximum9);

            C.PrintSettings printSettings9 = new C.PrintSettings();
            C.HeaderFooter headerFooter9 = new C.HeaderFooter();
            C.PageMargins pageMargins16 = new C.PageMargins(){ Left = 0.7D, Right = 0.7D, Top = 0.75D, Bottom = 0.75D, Header = 0.3D, Footer = 0.3D };
            C.PageSetup pageSetup9 = new C.PageSetup();

            printSettings9.Append(headerFooter9);
            printSettings9.Append(pageMargins16);
            printSettings9.Append(pageSetup9);

            C.ChartSpaceExtensionList chartSpaceExtensionList9 = new C.ChartSpaceExtensionList();
            chartSpaceExtensionList9.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            chartSpaceExtensionList9.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            C.ChartSpaceExtension chartSpaceExtension9 = new C.ChartSpaceExtension(){ Uri = "{781A3756-C4B2-4CAC-9D66-4F8BD8637D16}" };
            chartSpaceExtension9.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");

            C14.PivotOptions pivotOptions9 = new C14.PivotOptions();
            C14.DropZoneFilter dropZoneFilter9 = new C14.DropZoneFilter(){ Val = true };
            C14.DropZoneCategories dropZoneCategories9 = new C14.DropZoneCategories(){ Val = true };
            C14.DropZoneData dropZoneData9 = new C14.DropZoneData(){ Val = true };
            C14.DropZoneSeries dropZoneSeries9 = new C14.DropZoneSeries(){ Val = true };
            C14.DropZonesVisible dropZonesVisible9 = new C14.DropZonesVisible(){ Val = true };

            pivotOptions9.Append(dropZoneFilter9);
            pivotOptions9.Append(dropZoneCategories9);
            pivotOptions9.Append(dropZoneData9);
            pivotOptions9.Append(dropZoneSeries9);
            pivotOptions9.Append(dropZonesVisible9);

            chartSpaceExtension9.Append(pivotOptions9);

            chartSpaceExtensionList9.Append(chartSpaceExtension9);

            chartSpace9.Append(date19049);
            chartSpace9.Append(editingLanguage9);
            chartSpace9.Append(roundedCorners9);
            chartSpace9.Append(alternateContent20);
            chartSpace9.Append(pivotSource9);
            chartSpace9.Append(chart9);
            chartSpace9.Append(printSettings9);
            chartSpace9.Append(chartSpaceExtensionList9);

            chartPart9.ChartSpace = chartSpace9;
        }
        internal C.PieChartSeries ToPieChartSeries(bool IsStylish = false)
        {
            var pcs = new C.PieChartSeries();

            pcs.Index = new C.Index {
                Val = Index
            };
            pcs.Order = new C.Order {
                Val = Order
            };

            if (IsStringReference != null)
            {
                pcs.SeriesText = new C.SeriesText();
                if (IsStringReference.Value)
                {
                    pcs.SeriesText.StringReference = StringReference.ToStringReference();
                }
                else
                {
                    pcs.SeriesText.NumericValue = new C.NumericValue(NumericValue);
                }
            }

            if (Options.ShapeProperties.HasShapeProperties)
            {
                pcs.ChartShapeProperties = Options.ShapeProperties.ToChartShapeProperties(IsStylish);
            }

            if (Options.iExplosion != null)
            {
                pcs.Explosion = new C.Explosion {
                    Val = Options.Explosion
                }
            }
            ;

            if (DataPointOptionsList.Count > 0)
            {
                var indexlist = DataPointOptionsList.Keys.ToList();
                indexlist.Sort();
                int index;
                for (var i = 0; i < indexlist.Count; ++i)
                {
                    index = indexlist[i];
                    pcs.Append(DataPointOptionsList[index].ToDataPoint(index, IsStylish));
                }
            }

            if ((GroupDataLabelOptions != null) || (DataLabelOptionsList.Count > 0))
            {
                if (GroupDataLabelOptions == null)
                {
                    var gdloptions = new SLGroupDataLabelOptions(new List <Color>());
                    pcs.Append(gdloptions.ToDataLabels(DataLabelOptionsList, true));
                }
                else
                {
                    pcs.Append(GroupDataLabelOptions.ToDataLabels(DataLabelOptionsList, false));
                }
            }

            pcs.Append(AxisData.ToCategoryAxisData());
            pcs.Append(NumberData.ToValues());

            return(pcs);
        }
        // Generates content of chartPart1.
        public static void GenerateChartPart1Content(ChartPart chartPart1)
        {
            Chart.ChartSpace chartSpace1 = new Chart.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");
            Chart.EditingLanguage editingLanguage1 = new Chart.EditingLanguage()
            {
                Val = "fr-FR"
            };

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

            Chart.Title  title1  = new Chart.Title();
            Chart.Layout layout1 = new Chart.Layout();

            title1.Append(layout1);

            Chart.PlotArea plotArea1 = new Chart.PlotArea();
            Chart.Layout   layout2   = new Chart.Layout();

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

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

            Chart.SeriesText seriesText1 = new Chart.SeriesText();

            Chart.StringReference stringReference1 = new Chart.StringReference();
            Chart.Formula         formula1         = new Chart.Formula();
            formula1.Text = "Feuil1!$D$7";

            Chart.StringCache stringCache1 = new Chart.StringCache();
            Chart.PointCount  pointCount1  = new Chart.PointCount()
            {
                Val = (UInt32Value)1U
            };

            stringCache1.Append(pointCount1);

            stringReference1.Append(formula1);
            stringReference1.Append(stringCache1);

            seriesText1.Append(stringReference1);

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

            Chart.NumberReference numberReference1 = new Chart.NumberReference();
            Chart.Formula         formula2         = new Chart.Formula();
            formula2.Text = "Feuil1!$E$6:$H$6";

            Chart.NumberingCache numberingCache1 = new Chart.NumberingCache();
            Chart.FormatCode     formatCode1     = new Chart.FormatCode();
            formatCode1.Text = "General";
            Chart.PointCount pointCount2 = new Chart.PointCount()
            {
                Val = (UInt32Value)4U
            };

            numberingCache1.Append(formatCode1);
            numberingCache1.Append(pointCount2);

            numberReference1.Append(formula2);
            numberReference1.Append(numberingCache1);

            categoryAxisData1.Append(numberReference1);

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

            Chart.NumberReference numberReference2 = new Chart.NumberReference();
            Chart.Formula         formula3         = new Chart.Formula();
            formula3.Text = "Feuil1!$E$7:$H$7";

            Chart.NumberingCache numberingCache2 = new Chart.NumberingCache();
            Chart.FormatCode     formatCode2     = new Chart.FormatCode();
            formatCode2.Text = "General";
            Chart.PointCount pointCount3 = new Chart.PointCount()
            {
                Val = (UInt32Value)4U
            };

            numberingCache2.Append(formatCode2);
            numberingCache2.Append(pointCount3);

            numberReference2.Append(formula3);
            numberReference2.Append(numberingCache2);

            values1.Append(numberReference2);

            pieChartSeries1.Append(index1);
            pieChartSeries1.Append(order1);
            pieChartSeries1.Append(seriesText1);
            pieChartSeries1.Append(categoryAxisData1);
            pieChartSeries1.Append(values1);
            Chart.FirstSliceAngle firstSliceAngle1 = new Chart.FirstSliceAngle()
            {
                Val = (UInt16Value)0U
            };

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

            plotArea1.Append(layout2);
            plotArea1.Append(pieChart1);

            Chart.Legend         legend1         = new Chart.Legend();
            Chart.LegendPosition legendPosition1 = new Chart.LegendPosition()
            {
                Val = Chart.LegendPositionValues.Right
            };
            Chart.Layout layout3 = new Chart.Layout();

            legend1.Append(legendPosition1);
            legend1.Append(layout3);
            Chart.PlotVisibleOnly plotVisibleOnly1 = new Chart.PlotVisibleOnly()
            {
                Val = true
            };

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

            Chart.PrintSettings printSettings1 = new Chart.PrintSettings();
            Chart.HeaderFooter  headerFooter1  = new Chart.HeaderFooter();
            Chart.PageMargins   pageMargins1   = new Chart.PageMargins()
            {
                Left = 0.70000000000000007D, Right = 0.70000000000000007D, Top = 0.75000000000000011D, Bottom = 0.75000000000000011D, Header = 0.30000000000000004D, Footer = 0.30000000000000004D
            };
            Chart.PageSetup pageSetup1 = new Chart.PageSetup();

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

            chartSpace1.Append(editingLanguage1);
            chartSpace1.Append(chart1);
            chartSpace1.Append(printSettings1);

            chartPart1.ChartSpace = chartSpace1;
        }