- 165
- 0
- 约6.99千字
- 约 6页
- 2016-12-22 发布于贵州
- 举报
【e800编译】此示例中演示如何以编程方式在Microsoft PowerPoint 2010演示文稿中与表样式互动。此代码段是Office 2010的101项VBA代码示例中的一部分。与其它示例一样,这些将可以直接写入您的代码中。每块示例代码包含约5至50行的代码,分别演示了一个独特的功能或功能集,在VBA或VB以及C#中(在Visual Studio 2010中创建)。每个示例之中都会包含代码以及相应注释,这样您就可以直接运行获取预期的结果,或者是根据代码注释提示来调整环境,运行示例代码。Microsoft Office 2010提供了你所需要的工具来创建功能强大的应用程序。Microsoft Visual Basic Application(VBA)代码示例可以帮助你创建自己的应用程序,以执行特定功能或者以此为出发点实现更为复杂的功能。实例代码将此代码复制到演示文稿中中一个模块。并列放置VBA窗口与PowerPoint窗口,按F8(然后按住Shift+ F8)单步执行。SubTableStyleDemo() Create a new slide with a simple table:DimsldAsSlideSetsld=ActivePresentation.Slides.Add(2,ppLayoutTable)sld.SelectDimtblAsTableSettbl=sld.Shapes.AddTable(4,4).TableFillTabletbl In order to apply a style to a table, you must know the StyleID associated with the style. This information is not documented nor is there any way to retrieve this information for all the styles. This sample includes a list of all the table styles for PowerPoint 2010 at the end of the sample. These values are not guaranteed to work in any other version of PowerPoint.Withtbl.Cell(3,3).Shape.TextFrame.TextRange.Font.Bold=msoTrue.Font.Size=24EndWith Apply Light Style 1 - Accent 3, preserving existing styles.tbl.ApplyStyle{C083E6E3-FA7D-4D7B-A595-EF9225AFEA82},TrueDebug.PrintStyle.Name: tbl.Style.NameDebug.PrintStyle.Id : tbl.Style.Id Apply Dark Style 2 - Accent 5/Accent 6, without preserving styles. Note that this changes the Bold font back to normal, but doesnt affect font size:tbl.ApplyStyle{46F890A9-2807-4EBB-B81D-B2AA78EC7F39},FalseDebug.PrintStyle.Name: tbl.Style.NameDebug.PrintStyle.Id : tbl.Style.IdEndSubSubFillTable(tblAsTable) Fill a table with sample data.DimrowAsIntegerDimcolAsIntegerForcol=1Totbl.Columns.Counttbl.Cell(1,col).Shape.TextFrame.TextRange.Text=Heading colNextcolForrow=2Totbl.Rows.CountForcol=1Totbl.Columns.Counttbl.Cell(row,col).Shape.TextFrame.TextRange.Text=Cell row, colNextcolNextrowEndSub The following list includes the name and style for each of the available table styles. This list is undocumented, and was cre
您可能关注的文档
最近下载
- 2025 AI智能体的实践应用:评估与治理基础框架白皮书(中文).docx
- 2025-2026学年高一语文下学期开学摸底考试试题及答案详解(含范文参考).docx VIP
- 混凝土排水管道基础及接口 04S516.pdf VIP
- 基于LABVIEW的虚拟频谱分析仪设计.pdf VIP
- 潍柴WP7NG系列天然气发动机维修手册.PDF
- 数据结构期末复习题.docx VIP
- 2026年苏州健雄职业技术学院单招职业技能考试参考题库及答案详解.docx VIP
- 清洁能源领域:氢能企业的组织架构与职责.docx VIP
- T∕SIA 065-2025 智能体行为安全要求.pdf VIP
- 22G101三维图集合集.pdf VIP
原创力文档

文档评论(0)