none
How to add bar chart and pie chart in word document using microsoft word interop in c#? RRS feed

  • Question

  • Hi,

    I want to know how to add bar chart and pie chart  in word document using microsoft word interop in c#?

    Thanks in advance.

    Wednesday, June 22, 2016 10:30 AM

Answers

  • Hi,

    >> I want to know how to add bar chart and pie chart  in word document using microsoft word interop in c#?

    In word automation application like winform

    Add two references first:  Microsoft.Office.Interop.Word and Microsoft.Office.Core

    using Word = Microsoft.Office.Interop.Word;
    using Office = Microsoft.Office.Core;
            private void button1_Click(object sender, EventArgs e)
            {
                Word._Application oWord;
                Word._Document oDoc;
                oWord = new Word.Application();
                oWord.Visible = true;
                oDoc = oWord.Documents.Add();
                Word.InlineShape oShape ;
                oShape = oDoc.InlineShapes.AddChart(Office.XlChartType.xlBarClustered);
         Word.InlineShape pieChart;
                pieChart = oDoc.InlineShapes.AddChart(Office.XlChartType.xlPie);
            }

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    Thursday, June 23, 2016 6:51 AM