تعيين نمط نص فني محدد مسبقًا لنص الشكل
سيناريوهات الاستخدام المحتملة
يمكنك ضبط نمط WordArt المُعدّ مُسبقًا لنص الشكل باستخدام Aspose.Cels. يرجى استخدام FontSetting.SetWordArtStyle() أو FontSettingCollection.SetWordArtStyle() لهذا الغرض.
تعيين نمط WordArt المحدد مسبقًا لنص الشكل
ينشئ الكود النموذجي التالي مربع نص مع بعض النص ثم يقوم بضبط نمط WordArt المُعدّ مُسبقًا لنصه باستخدام الطريقة FontSetting.SetWordArtStyle() . ها هو كيف يبدو ملف الإكسل الناتج في Microsoft Excel.
الكود المثالي
// 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(SetPresetWordArtStyle.class) + "articles/"; | |
//Create workbook object | |
Workbook wb = new Workbook(); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Create a textbox with some text | |
int idx = ws.getTextBoxes().add(0, 0, 100, 700); | |
TextBox tb = ws.getTextBoxes().get(idx); | |
tb.setText("Aspose File Format APIs"); | |
tb.getFont().setSize(44); | |
//Sets preset WordArt style to the text of the shape. | |
ArrayList<FontSetting> aList = tb.getCharacters(); | |
FontSetting fntSetting = aList.get(0); | |
fntSetting.setWordArtStyle(PresetWordArtStyle.WORD_ART_STYLE_3); | |
//Save the workbook in xlsx format | |
wb.save(dataDir + "SetPresetWordArtStyle_out.xlsx"); |