Zeichenabstand eines Excel TextBoxes oder einer Form ändern
Contents
[
Hide
]
Sie können den Zeichenabstand einer Excel-Textbox oder Form mithilfe der Eigenschaft FontSetting.text_options.spacing ändern.
Der folgende Beispielcode ändert den Zeichenabstand des Textfelds in einer Excel-Datei auf 4 und speichert ihn dann auf der Festplatte.
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
from aspose import pycore | |
from aspose.cells import FontSetting, SaveFormat, Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Source directory | |
sourceDir = RunExamples.Get_SourceDirectory() | |
# Output directory | |
outputDir = RunExamples.Get_OutputDirectory() | |
# Load your excel file inside a workbook obect | |
wb = Workbook(sourceDir + "sampleChangeTextBoxOrShapeCharacterSpacing.xlsx") | |
# Access your text box which is also a shape object from shapes collection | |
shape = wb.worksheets[0].shapes[0] | |
# Access the first font setting object via GetCharacters() method | |
fs = pycore.cast(FontSetting, shape.get_characters()[0]) | |
# Set the character spacing to point 4 | |
fs.text_options.spacing = 4.0 | |
# Save the workbook in xlsx format | |
wb.save(outputDir + "outputChangeTextBoxOrShapeCharacterSpacing.xlsx", SaveFormat.XLSX) |