如何从C#更改PowerPoint中TextRange的字体颜色?
发布时间:2020-12-15 08:40:17 所属栏目:百科 来源:网络整理
导读:我使用C#创建了一个PowerPoint演示文稿: PowerPoint.Application powerpointApplication;PowerPoint.Presentation pptPresentation;PowerPoint.Slide Slide;// Create an instance of PowerPoint.powerpointApplication = new PowerPoint.ApplicationClass(
我使用C#创建了一个PowerPoint演示文稿:
PowerPoint.Application powerpointApplication; PowerPoint.Presentation pptPresentation; PowerPoint.Slide Slide; // Create an instance of PowerPoint. powerpointApplication = new PowerPoint.ApplicationClass(); // Create a PowerPoint presentation. pptPresentation = powerpointApplication.Presentations.Add( Microsoft.Office.Core.MsoTriState.msoTrue); // Create empty slide Slide = pptPresentation.Slides.Add(1,PowerPoint.PpSlideLayout.ppLayoutBlank); TextRange objTextRng = objSlide.Shapes[1].TextFrame.TextRange; objTextRng.Text = "Remote sensing calendar 1"; objTextRng.Font.Name = "Comic Sans MS"; objTextRng.Font.Size = 48; // TODO: change color // objTextRng.Font.Color // Save presentation pptPresentation.SaveAs( BasePath + "result2_example.ppt",PowerPoint.PpSaveAsFileType.ppSaveAsDefault,MsoTriState.msoTrue // TODO: что за параметр??? ); pptPresentation.Close(); 现在,我该如何更改objTextRng的字体颜色? 解决方法
以下代码将字体颜色设置为红色:
objTextRng.Font.Color.RGB = Color.Red.ToArgb(); 如果要指定其他颜色,可以使用其他pre-defined colors之一,或使用 无论哪种方式,请确保在您使用的Color对象上调用 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- Flex ModuleLoader和ModuleManager的区别、Modul
- ajaxfileupload 返回json解析出错 带有<pre>标签
- Displays information relevant to flashback da
- ruby-on-rails – config.assets.precompile不添
- ruby – 如果仅为None,则如何分配给Option
- GD/Chart模块的平台依赖关系
- 4、cocos2d-Lua的demo--游戏逻辑GameView
- 在AJAX登录调用中进行Javascript哈希,更安全吗?
- Flashback Version Query && Flashback
- sqlite 链接
热点阅读