Hi everyone, this is my first question.
I want to add Office Graph in Word 2007 using C # 4.0,
I use the word Office 2007 for better graphs such as 3D Bubble My task is a Genrate Graph and a table from the sql database, I did it in good plan using an Excel chart, and then copy the graph as an image in a word.
Now I want to add a chart to the word so that the user can change the chart or its value. I am currently 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 code below works fine, but the result is not very good as I want. if I use "Excel.Chart.8" set to "MSGraph.Chart.8", it gives me an error.
Jsj source
share