Aspose Slide for .net C# 更改形状的文本颜色
Aspose Slide for .net C# change text color of a shape
我找不到更改矩形自选图形文本颜色的方法,请问有什么帮助吗?
此处代码摘录:
// Add shape
IAutoShape shape= slide.Shapes.AddAutoShape(ShapeType.Rectangle, 20, 677, 250, 40);
((IAutoShape)shape).AddTextFrame( "Hello world!");
默认颜色为白色,如何更改?
以下代码示例显示了如何使用 Aspose.Slides for .NET 更改形状的文本颜色:
var paragraph = shape.TextFrame.Paragraphs[0];
paragraph.ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillType.Solid;
paragraph.ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Red;
如果您在 Aspose.Slides forum.
上提问,您将更快地获得支持和问题的答案
我在 Aspose 担任支持开发人员。
我这样做了并且有效:
//In order to Have a no filled rectangle
((IAutoShape)shape).FillFormat.FillType = FillType.NoFill;
ITextFrame tf1 = ((IAutoShape)shape).TextFrame;
// Accessing the first Paragraph of validityDate
IParagraph para1 = tf1.Paragraphs[0];
// Accessing the first portion
IPortion port1 = para1.Portions[0];
// Define new fonts
FontData fd1 = new FontData("Arial");
// Assign new fonts to portion
port1.PortionFormat.LatinFont = fd1;
// Set font color
port1.PortionFormat.FillFormat.FillType = FillType.Solid;
port1.PortionFormat.FillFormat.SolidFillColor.Color = Color.Gray;
// Set the Height of the Font
port1.PortionFormat.FontHeight = 13;
我找不到更改矩形自选图形文本颜色的方法,请问有什么帮助吗?
此处代码摘录:
// Add shape
IAutoShape shape= slide.Shapes.AddAutoShape(ShapeType.Rectangle, 20, 677, 250, 40);
((IAutoShape)shape).AddTextFrame( "Hello world!");
默认颜色为白色,如何更改?
以下代码示例显示了如何使用 Aspose.Slides for .NET 更改形状的文本颜色:
var paragraph = shape.TextFrame.Paragraphs[0];
paragraph.ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillType.Solid;
paragraph.ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Red;
如果您在 Aspose.Slides forum.
上提问,您将更快地获得支持和问题的答案我在 Aspose 担任支持开发人员。
我这样做了并且有效:
//In order to Have a no filled rectangle
((IAutoShape)shape).FillFormat.FillType = FillType.NoFill;
ITextFrame tf1 = ((IAutoShape)shape).TextFrame;
// Accessing the first Paragraph of validityDate
IParagraph para1 = tf1.Paragraphs[0];
// Accessing the first portion
IPortion port1 = para1.Portions[0];
// Define new fonts
FontData fd1 = new FontData("Arial");
// Assign new fonts to portion
port1.PortionFormat.LatinFont = fd1;
// Set font color
port1.PortionFormat.FillFormat.FillType = FillType.Solid;
port1.PortionFormat.FillFormat.SolidFillColor.Color = Color.Gray;
// Set the Height of the Font
port1.PortionFormat.FontHeight = 13;