设置 Shape 或 TextBox 的文字效果的阴影
Contents
[
Hide
]
您可以设置阴影的文字效果任何形状或文本框。请使用形状.TextBody财产。它呈现形状文本的设置并返回字体设置对象。访问后,请设置阴影通过字体设置.TextOptions.Shadow.PresetType.PresetType财产。该属性属于预设阴影类型它有几个值。其中一些是
- 偏移对角线底部右
- 偏移底部
- 偏移对角线右上角
- 内左
- 内部中心
- 透视对角线左上角
- 透视对角线下右
下面的代码片段演示了使用字体设置.TextOptions.Shadow.PresetType.PresetType属性设置 Shape 或 TextBox 的文本效果的阴影。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
//Output directory | |
string outputDir = RunExamples.Get_OutputDirectory(); | |
// Create workbook object | |
Workbook wb = new Workbook(); | |
// Access first worksheet | |
Worksheet ws = wb.Worksheets[0]; | |
// Add text box with these dimensions | |
TextBox tb = ws.Shapes.AddTextBox(2, 0, 2, 0, 100, 400); | |
// Set the text of the textbox | |
tb.Text = "This text has the following settings.\n\nText Effects > Shadow > Offset Bottom"; | |
// Set all the text runs shadow to preset offset bottom | |
for (int i = 0; i < tb.TextBody.Count; i++) | |
{ | |
tb.TextBody[i].TextOptions.Shadow.PresetType = PresetShadowType.OffsetBottom; | |
} | |
// Set the font color and size of the textbox | |
tb.Font.Color = Color.Red; | |
tb.Font.Size = 16; | |
// Save the output file | |
wb.Save(outputDir + "outputSettingTextEffectsShadowOfShapeOrTextbox.xlsx", SaveFormat.Xlsx); |