添加具有内置样式的艺术字文本
Contents
[
Hide
]
可能的使用场景
您可以使用Aspose.Cells添加具有内置样式的艺术字文本。请使用[ShapeCollection.AddWordArt()](https://reference.aspose.com/cells/java/com.aspose.cells/shapecollection#addWordArt(int,%20java.lang.String,%20int,%20int,%20int,%20int,%20int,%20int))方法来实现此目的。
添加具有内置样式的艺术字文本
以下示例代码添加了不同内置样式的艺术字文本。请检查此代码生成的output excel file。这是在Microsoft Excel中查看output excel file的方式。
示例代码
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-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(AddWordArtText.class) + "articles/"; | |
// Create workbook object | |
Workbook wb = new Workbook(); | |
// Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
// Add Word Art Text with Built-in Styles | |
ws.getShapes().addWordArt(PresetWordArtStyle.WORD_ART_STYLE_1, "Aspose File Format APIs", 00, 0, 0, 0, 100, 800); | |
ws.getShapes().addWordArt(PresetWordArtStyle.WORD_ART_STYLE_2, "Aspose File Format APIs", 10, 0, 0, 0, 100, 800); | |
ws.getShapes().addWordArt(PresetWordArtStyle.WORD_ART_STYLE_3, "Aspose File Format APIs", 20, 0, 0, 0, 100, 800); | |
ws.getShapes().addWordArt(PresetWordArtStyle.WORD_ART_STYLE_4, "Aspose File Format APIs", 30, 0, 0, 0, 100, 800); | |
ws.getShapes().addWordArt(PresetWordArtStyle.WORD_ART_STYLE_5, "Aspose File Format APIs", 40, 0, 0, 0, 100, 800); | |
// Save the workbook in xlsx format | |
wb.save(dataDir + "AddWordArtText_out.xlsx"); |