Implement Errors and Boolean Value in Russian or Any Other Language

Possible Usage Scenarios

If you are using Microsoft Excel in Russian Locale or Language or any other Locale or Language, it will display Errors and Boolean values according to that Locale or Language. You can achieve similar behavior by using Aspose.Cells Workbook.getSettings().setGlobalizationSettings() method or property. You will have to override the following methods of GlobalizationSettings class.

Implement Errors and Boolean Value in Russian or Any Other Language

The following sample code illustrates how to implement Errors and Boolean Value in Russian or Any Other Language. Please check the Sample Excel File used in this code and its Output PDF. The screenshot shows the difference between Sample Excel File and the Output PDF for a reference.

todo:image_alt_text

Sample Code

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
public class ImplementErrorsAndBooleanValueInRussianOrAnyOtherLanguage {
// Russian Globalization
class RussianGlobalization extends GlobalizationSettings {
public String getErrorValueString(String err) {
switch (err.toUpperCase()) {
case "#NAME?":
return "#RussianName-имя?";
}
return "RussianError-ошибка";
}
public String getBooleanValueString(Boolean bv) {
return bv ? "RussianTrue-правда" : "RussianFalse-ложный";
}
}
public void Run() throws Exception {
System.out.println("Aspose.Cells for Java Version: " + CellsHelper.getVersion());
String srcDir = Utils.Get_SourceDirectory();
String outDir = Utils.Get_OutputDirectory();
// Load the source workbook
Workbook wb = new Workbook(srcDir + "sampleRussianGlobalization.xlsx");
// Set GlobalizationSettings in Russian Language
wb.getSettings().setGlobalizationSettings(new RussianGlobalization());
// Calculate the formula
wb.calculateFormula();
// Save the workbook in pdf format
wb.save(outDir + "outputRussianGlobalization.pdf");
}
public static void main(String[] args) throws Exception {
ImplementErrorsAndBooleanValueInRussianOrAnyOtherLanguage impErr = new ImplementErrorsAndBooleanValueInRussianOrAnyOtherLanguage();
impErr.Run();
}
}