Modifica la spaziatura dei caratteri della casella di testo o della forma di Excel
Contents
[
Hide
]
È possibile modificare la spaziatura dei caratteri della casella di testo o della forma di Excel utilizzando ilFontSetting.TextOptions.Spacing proprietà.
Modifica la spaziatura dei caratteri della casella di testo o della forma di Excel
Il seguente codice di esempio modifica la spaziatura dei caratteri della casella di testo in un file excel al punto 4 e quindi la salva su disco.
Lo screenshot seguente mostra come il filefile excel di esempio guarda prima dell’esecuzione del codice.
Lo screenshot seguente mostra come il filefile excel di output si occupa dell’esecuzione del codice.
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
// 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(ChangeCharacterSpacing.class) + "articles/"; | |
// Load your excel file inside a workbook obect | |
Workbook wb = new Workbook(dataDir + "character-spacing.xlsx"); | |
// Access your text box which is also a shape object from shapes collection | |
Shape shape = wb.getWorksheets().get(0).getShapes().get(0); | |
// Access the first font setting object via GetCharacters() method | |
ArrayList<FontSetting> lst = shape.getCharacters(); | |
FontSetting fs = lst.get(0); | |
// Set the character spacing to point 4 | |
fs.getTextOptions().setSpacing(4); | |
// Save the workbook in xlsx format | |
wb.save(dataDir + "CCSpacing_out.xlsx", SaveFormat.XLSX); |