Hi every one this is my first question here.
I want to add a Office Graph in word 2007 using C# 4.0,
I am using Office 2007 word, for better charts like 3D Bubble My task is to Genrate Graph and table from sql database i have done it in good menner with using the excel chart then copy chart as image in word.
now i want to add chart itself in word so that the user can change the chart or its value. currently i m doing this code.
object missing = Type.Missing;
Word.Application application = new
Microsoft.Office.Interop.Word.Application();
application.Visible = true;
Word.Document document = application.Documents.Add(ref missing, ref missing, ref missing,
ref missing);
Random rd = new Random();
objchart = (Graph.Chart)document.Shapes.AddOLEObject("MSGraph.Chart.8").OLEFormat.Object;
dataSheet = objchart.Application.DataSheet;
for (int r = 1; r < 10; r++)
{ for (int c = 1; c < 5; c++) { dataSheet.Cells[r, c] = rd.Next(10, 50); } }
the below code is working fine but the result is not good as i want. if i use "Excel.Chart.8" insteed of "MSGraph.Chart.8" it gives me error.