Word中插入图表及如何控制提问

syncml 2006-09-17 07:38:35
我用word控件向word文档里插入了一张图表,(MSGraph.Chart.8),图表显示一年12个月的收入,现在我想向chart里输入每月的收入,我不知道如何输入这些数据,也不知道如何控制图表的表现形式,比如条形,柱形,,望指教?

//Insert a chart.
Word.InlineShape oShape;

object oClassType = "MSGraph.Chart.8";
wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oShape = wrdRng.InlineShapes.AddOLEObject(ref oClassType, ref oMissing,
ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing);

//Demonstrate use of late bound oChart and oChartApp objects to
//manipulate the chart object with MSGraph.
object oChart;
object oChartApp;
oChart = oShape.OLEFormat.Object;
oChartApp = oChart.GetType().InvokeMember("Application",
BindingFlags.GetProperty, null, oChart, null);

//Change the chart type to Line.
object[] Parameters = new Object[1];
Parameters[0] = 4; //xlLine = 4 //这里值只能是4或者5么?
oChart.GetType().InvokeMember("ChartType", BindingFlags.SetProperty,
null, oChart, Parameters);

//Update the chart image and quit MSGraph.
oChartApp.GetType().InvokeMember("Update",
BindingFlags.InvokeMethod, null, oChartApp, null);
oChartApp.GetType().InvokeMember("Quit",
BindingFlags.InvokeMethod, null, oChartApp, null);
...全文
494 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
abinglu 2006-10-08
  • 打赏
  • 举报
回复
我一直在找,vb如何操作word的图表,往图表里填数据。
syncml 2006-09-20
  • 打赏
  • 举报
回复
再顶一下,失望Ing
mlhy20060406 2006-09-19
  • 打赏
  • 举报
回复
UP
syncml 2006-09-19
  • 打赏
  • 举报
回复
UP
syncml 2006-09-18
  • 打赏
  • 举报
回复
Parameters[0] = 4; //xlLine = 4 //这里值只能是4或者5么?


这里我知道怎么回事了,

Parameters[0] = Graph.XlChartType.xl3DBarClustered ; //应该怎么设置

下面剩下的问题就是如何传递数据到图表了,找了半天的资料,还是不知道如何处理

110,580

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧