最近项目研究打印Word图表的问题,网上这方面资料挺少的,很多关于打印Word表格的,图表方面的资料挺少,MSND上也没有具体的资料,有几个demo,但都是很浅显的应用。其实我想找的是word图表各项属性的说明。因为我想设置图表的属性,根本没有参照。以下是自己总结的一些属性。
// 给图表显示一个标题(显示在图表最上面)
objChart.HasTitle = true;
objChart.ChartTitle.Text = chartName;
// 设置图表区域的字体
objChart.ChartArea.Font.Size = float.Parse("4.75");
objChart.ChartArea.Font.Name = "Times New Roman";
// 设置图表Legend区域的字体
objChart.HasLegend = true;
objChart.Legend.Font.Name = "宋体";
objChart.Legend.Font.Size = float.Parse("4.75");
// 根据Y轴画图表
objChart.Application.PlotBy = Microsoft.Office.Interop.Graph.XlRowCol.xlColumns;
//设置X轴的属性
Microsoft.Office.Interop.Graph.Axis axis = (Microsoft.Office.Interop.Graph.Axis)objChart.Axes(1, 1);
axis.HasTitle = true;
// 设置X轴
// 给图表显示一个标题(显示在图表最上面)
objChart.HasTitle = true;
objChart.ChartTitle.Text = chartName;
// 设置图表区域的字体
objChart.ChartArea.Font.Size = float.Parse("4.75");
objChart.ChartArea.Font.Name = "Times New Roman";
// 设置图表Legend区域的字体
objChart.HasLegend = true;
objChart.Legend.Font.Name = "宋体";
objChart.Legend.Font.Size = float.Parse("4.75");
// 根据Y轴画图表
objChart.Application.PlotBy = Microsoft.Office.Interop.Graph.XlRowCol.xlColumns;
//设置X轴的属性
Microsoft.Office.Interop.Graph.Axis axis = (Microsoft.Office.Interop.Graph.Axis)objChart.Axes(1, 1);
axis.HasTitle = true;
// 设置X轴