Impostazione dell ombra degli effetti di testo della forma o del riquadro di testo
È possibile impostare l'Ombra degli Effetti di testo di qualsiasi forma o casella di testo. Si prega di utilizzare la proprietà Shape.TextBody. Essa rappresenta l’impostazione del testo della forma e restituisce oggetti FontSetting. Dopo avervi accesso, si prega di impostare l'Ombra tramite la proprietà FontSetting.TextOptions.Shadow.PresetType.PresetType. Questa proprietà è del tipo PresetShadowType che ha diversi valori. Alcuni di questi sono
- DiagonaleOffsetInferioreDestra
- OffsetInferiore
- DiagonaleOffsetSuperioreDestra
- SinistraInterno
- CentroInterno
- DiagonaleSuperioreSinistraProspettiva
- DiagonaleInferioreDestraProspettiva
Il seguente frammento di codice dimostra l’uso della proprietà FontSetting.TextOptions.Shadow.PresetType.PresetType per impostare l’ombra degli effetti di testo della forma o della casella di testo.
// 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); |