首页 > 单独文章 > 正文

OFFICE中的字符模型

时间:2009-08-21 22:34:10 作者:officeba 【认证】
在某些绘制下一个三杆,这blog将盖住的的海域图,改变已经被估计是是客户的直接结果的在朝派办公室2010,很多的的上方绘制物件模范在朝派词和PowerPoint的海域图反馈. 作为的一部分我们检修遍及绘制办公室的海域图的办公室2007发行;但是一OM为词和PowerPoint was不抚养.作为对你的的反应,反馈在办公室中2007 SP2和办公室2010 we’ve使绘制在词以内OM和PowerPoint的海域图使/统一//始终如一a曝光,因此你能写作解决方案反对新事物绘制才能的海域图的应用那拿优势任何.图被同样的分担办公室图画层吸引,所以如果你是熟悉OM,在朝派在方面胜过你能容易建立的一相似的在词金色PowerPoint中的溶液2007. 公司在文件或者颁发中有一需要要建立图的许多次把特有数据建立在客户的基础上.变成很多份这些图格式化,相比和安放让一标准的制做他们a的情况使为自动化的候选人起动.这OM能被使用作为一部分一解决方案产生这些能为节约很多小时的体力劳动的图自动化. Let’s拿一看一例子.这里是一怎样建立PowerPoint把一图在朝派建立在你的应用已经找回的数据的基础上的和应用标准格式的例子. 预支CreateChart 使myChart某样的人图变得暗淡 暗淡gChartData某样的人ChartData 暗淡gWorkBook某样的人Excel.Workbook 暗淡gWorkSheet某样的人Excel.Worksheet myChart=ActivePresentation.Slides(1).Shapes.AddChart.Chart建立的装置是装置图 设定gChartData=ActivePresentation.Slides(1).Shapes(1).Chart.ChartData装置chartdata 设定gWorkBook=gChartData.Workbook装置练习册物件参考资料 设定gWorkSheet=gWorkBook.Worksheets(1)装置工作单物件参考资料 gWorkSheet.ListObjects("(Table1)".ResizegWorkSheet.Range("(A1:B5)"添加数据 gWorkSheet.Range("Table1[[#Headers][,串联1)"]].Value="销售" gWorkSheet.Range("(a2)".Value="骑自行车" gWorkSheet.Range("(a3)".Value="附件" gWorkSheet.Range("a4").Value = "Repairs" gWorkSheet.Range("a5").Value = "Clothing" gWorkSheet.Range("b2").Value = "1000" gWorkSheet.Range("b3").Value = "2500" gWorkSheet.Range("b4").Value = "4000" gWorkSheet.Range("b5").Value = "3000" With myChart 'Apply Style .ChartStyle = 4 .ApplyLayout 4 .ClearToMatchStyle End With myChart.HasTitle = True 'Add Title With myChart.ChartTitle 'Format title .Characters.Font.Size = 18 .Text = "2007 Sales" End With With myChart.Axes(xlValue) 'Add axis title .HasTitle = True .AxisTitle.Text = "$" End With myChart.ApplyDataLabels 'Add data labels Set gWorkSheet = Nothing gWorkBook.Application.Quit Set gWorkBook = Nothing Set gChartData = Nothing Set myChart = Nothing End Sub As you can see a chart is still represented by a ChartObject and in this case is contained by a Shape. It can be contained by either an InlineShape or Shape in Word and a Shape in PowerPoint. From there the ChartObject is generally a mirror of what you would see in Excel. Some key differences are: Properties/Methods that normally accept a range object in Excel now accept a string of the range address in Word and PowerPoint. A new object, ChartData, has been added to Word and PowerPoint to access the underlying linked or embedded data for a chart. The ability to programmatically manipulate charts in Word and PowerPoint also opens the door for a variety of interesting solutions around dynamically changing the appearance of your charts during a presentation or creating an interactive Word document. Here is an example of a solution to add data labels to a chart during a presentation: Private Sub BtnDataLabels_Click() Set myChart = ActivePresentation.Slides(1).Shapes(1).Chart 'Set chart object reference myChart.ApplyDataLabels 'Add data labels Set myChart = Nothing End Sub Try it out and let us know what you think!

相关文章

同类最新