ضبط الظلال لتأثيرات النص للشكل أو مربع النص
يمكنك ضبط الظلال لتأثيرات النص لأي شكل أو مربع نص. الرجاء استخدام خاصية Shape.TextBody. يقدم إعداد نص الشكل ويُرجع FontSettingCollection. بعد الوصول إلى FontSetting منه، يرجى ضبط الظل عبر خاصية FontSetting.getTextOptions().getShadow().setPresetType(). هذه الخاصية من نوع PresetShadowType وتحتوي على قيم متعددة. بعض هذه هي
ضبط ظلال تأثيرات النص للشكل أو مربع النص
تُظهر اللقطة المصغرة التالية ملف الإكسل الناتج الذي تم إنشاؤه باستخدام رمز العينة التالي. تُظهر اللقطة المصغرة أيضًا قيمة الظل التي تم ضبطها كـ الظل السفلي.
// 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(SettingTextEffectsShadowOfShapeOrTextbox.class) + "articles/"; | |
// Create workbook object | |
Workbook wb = new Workbook(); | |
// Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
// Add text box with these dimensions | |
int idx = ws.getTextBoxes().add(2, 2, 100, 400); | |
TextBox tb = ws.getTextBoxes().get(idx); | |
// Set the text of the textbox | |
tb.setText("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.getTextBody().getCount(); i++) { | |
tb.getTextBody().get(i).getTextOptions().getShadow().setPresetType(PresetShadowType.OFFSET_BOTTOM); | |
} | |
// Set the font color and size of the textbox | |
tb.getFont().setColor(Color.getRed()); | |
tb.getFont().setSize(16); | |
// Save the output file | |
wb.save(dataDir + "STESOfShapeOrTextbox_out.xlsx", SaveFormat.XLSX); |