将文本形状的文字设置为预设的WordArt样式
Contents
[
Hide
]
可能的使用场景
您可以使用Aspose.Cells为形状的文本设置预设的WordArt样式。请使用FontSetting.SetWordArtStyle()或FontSettingCollection.SetWordArtStyle()方法来实现此目的。
将文本形状的文字设置为预设的WordArt样式
以下示例代码创建一个带有一些文本的文本框,然后使用FontSetting.SetWordArtStyle()方法设置其文本的预设WordArt样式。这是输出excel文件在Microsoft Excel中的外观。
This file contains hidden or 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 | |
// Create workbook object | |
Workbook workbook = new Workbook(); | |
// Access first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Create a textbox with some text | |
TextBox textbox = worksheet.Shapes.AddTextBox(0, 0, 0, 0, 100, 700); | |
textbox.Text = "Aspose File Format APIs"; | |
textbox.Font.Size = 44; | |
// Sets preset WordArt style to the text of the shape. | |
FontSetting fntSetting = textbox.GetRichFormattings()[0] as FontSetting; | |
fntSetting.SetWordArtStyle(PresetWordArtStyle.WordArtStyle3); | |
// Save the workbook in xlsx format | |
workbook.Save(outputDir + "outputSetPresetWordArtStyle.xlsx"); |