Implementa le etichette Subtotale o Totale complessivo in altre lingue
Contents
[
Hide
]
Possibili scenari di utilizzo
volte, vuoi mostrare le etichette del totale parziale e del totale complessivo in lingue diverse dall’inglese come cinese, giapponese, arabo, hindi ecc. Aspose.Cells ti consente di farlo utilizzando ilImpostazioni di globalizzazione classe eWorkbookSettings.GlobalizationSettings proprietà. Si prega di consultare questo articolo su come utilizzareImpostazioni di globalizzazioneclasse
Implementa le etichette Subtotale o Totale complessivo in altre lingue
Il codice di esempio seguente carica il filefile excel di esempio e implementa i nomi dei subtotali e dei totali complessivi nel fileCinese linguaggio. Si prega di controllarefile excel di output generato da questo codice per riferimento.
Codice d’esempio
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 | |
//This function will return the sub total name | |
public String getTotalName(int functionType) | |
{ | |
return "Chinese Total - 可能的用法"; | |
} | |
//This function will return the grand total name | |
public String getGrandTotalName(int functionType) | |
{ | |
return "Chinese Grand Total - 可能的用法"; | |
} |
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(ImplementSubtotalGrandTotallabels.class) + "articles/"; | |
// Load your source workbook | |
Workbook wb = new Workbook(dataDir + "sample.xlsx"); | |
// Set the glorbalization setting to change subtotal and grand total | |
// names | |
GlobalizationSettings gsi = new GlobalizationSettingsImp(); | |
wb.getSettings().setGlobalizationSettings(gsi); | |
// Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
// Apply subtotal on A1:B10 | |
CellArea ca = CellArea.createCellArea("A1", "B10"); | |
ws.getCells().subtotal(ca, 0, ConsolidationFunction.SUM, new int[] { 2, 3, 4 }); | |
// Set the width of the first column | |
ws.getCells().setColumnWidth(0, 40); | |
// Save the output excel file | |
wb.save(dataDir + "ImplementTotallabels_out.xlsx"); |