- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我使用 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 + "result\\2_example.ppt",
PowerPoint.PpSaveAsFileType.ppSaveAsDefault,
MsoTriState.msoTrue // TODO: что за параметр???
);
pptPresentation.Close();
现在,如何更改 objTextRng
的字体颜色?
最佳答案
以下代码会将字体颜色设置为红色:
objTextRng.Font.Color.RGB = Color.Red.ToArgb();
如果你想指定不同的颜色,你可以使用另一个pre-defined colors ,或使用 Color.FromArgb
method 指定您自己的 RGB 值.
无论哪种方式,请确保您调用了 ToArgb
method在您使用的 Color
对象上。 RGB
属性要求指定 RGB 颜色值。
关于c# - 如何从 C# 更改 PowerPoint 中 TextRange 的字体颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5247135/
在powerpoint中通过VBA生成幻灯片的过程中,我需要在生成的文本中插入一个“Wingdings符号”,这是两个值的比较。我制作了这个方法,它完全按照我的意愿工作 Sub formatDiffe
我在使用 RichTextBox 时遇到了一个小问题。 我正在尝试进行某种聊天,包括每行不同的颜色,这就是我使用 RichTextBox 而不是普通文本框的原因。但是我在换行时遇到了一些麻烦。 我的目
textRange IE11的moveToPoint()方法有问题; 如果指向的节点不在第一个屏幕中,似乎它不起作用; document.addEventListener( "click", func
我尝试使用 TextRange.GetPropertyValue(DependencyProperty),但找不到将特定范围标识为超链接的依赖属性。 如果不使用 TextRange,是否仍然可以查找
我正在尝试序列化其中具有 TextRange 类型属性的类。 示例: public class MyClass { private string someProp; public st
我正在尝试使用 WPF RichTextEditor 实现基本语法突出显示。为此,我想以不同的颜色显示 {} gropus。 下面是应该将 RichTextBox 的内容分成不同组的代码: L
我在使用 contentEditable 设置为 true 的 IE 文档时遇到异常问题。在位于 block 元素之前的文本节点末尾的范围上调用 select() 会导致选择向右移动一个字符并出现在不
我正在使用我在网上找到的以下代码, http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/750a654e-b002-4742-8f46-6
我有 RichTextBox,它类似于“控制台”。在“cmd”中,我显示来自 SSH 连接的数据,我还允许在“cmd”RichTextBox 中写入一些内容。 public void ConnectT
在 WPF 应用程序中,我们可以按如下方式获取 TextRange(或参见 this post 或示例 here ): var textRange = new TextRange(richTextBo
我目前正在从事语法高亮和代码完成项目,并基于 RichTextBox 制作用户控件。我在适应 RTB 的工作方式和所有方面时遇到了一些问题,但我设法进行了简单的语法突出显示。 简单意味着每次用户键入一
据我所知,没有简单的方法可以从 Internet Explorer 中的 TextRange 对象中检索字符偏移量。 W3C Range 对象有一个节点,以及该节点内文本的偏移量。 IE 似乎只有像素
我想复制一些文本及其格式。如果整个文本以一种方式格式化,那么这很容易做到,但我无法复制以不同方式格式化的文本(例如,文本的某些部分是粗体,有些则不是)。 有类似 Run 的东西,我知道如何阅读它(以及
我有两个不同的 C++ 项目,一个编译为静态库并使用 Unicode 字符编码,因为它必须支持多种语言(拼写检查器),另一个是使用 MultiByteCharacterSet 编码的遗留 MFC 项目
我试图让用户在 SfRichTextBoxAdv 中进行选择并将这些选择(文本范围)保存到一个集合中。问题是我还希望文本范围在文本添加或删除之前更新它们的开始/结束位置。即:如果在文本范围之前添加文本
在我的 System.Windows.Controls.RichTextBox 中,我想找到给定单词的 TextRange。但是,在第一个找到的单词之后,它没有给我正确的 PositionAtOffs
我使用 C# 创建了一个 PowerPoint 演示文稿: PowerPoint.Application powerpointApplication; PowerPoint.Presentation
查找文本范围的位置时(例如当前选择的文本),我似乎已经发现Internet Explorer 8出现问题。我找不到能够在StackOverflow或其他地方找到此问题的任何报告。 TextRange.
SlideNumber = 1 Set oPPTSlide = oPPTFile.Slides(SlideNumber) For y = 1 To oPPTSlide.Shapes.Count
在尝试将 WPF 代码(显示在最后)转换为 UWP 代码时,我遇到了两个挑战: UWP 相当于 TexRange WPF 中的对象。 UWP 相当于 TexRange.Load(...) WPF 中的
我是一名优秀的程序员,十分优秀!