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 a similar behavior using Aspose.Cells by using the Workbook.Settings.GlobalizationSettings 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.
Sample Code
//Russian Globalization | |
class RussianGlobalization : GlobalizationSettings | |
{ | |
public override string GetErrorValueString(string err) | |
{ | |
switch (err.ToUpper()) | |
{ | |
case "#NAME?": | |
return "#RussianName-имя?"; | |
} | |
return "RussianError-ошибка"; | |
} | |
public override string GetBooleanValueString(bool bv) | |
{ | |
return bv ? "RussianTrue-правда" : "RussianFalse-ложный"; | |
} | |
} | |
//-------------------------------- | |
//-------------------------------- | |
public class ImplementErrorsAndBooleanValueInRussianOrAnyOtherLanguage | |
{ | |
public static void Run() | |
{ | |
//Load the source workbook | |
Workbook wb = new Workbook("sampleRussianGlobalization.xlsx"); | |
//Set GlobalizationSettings in Russian Language | |
wb.Settings.GlobalizationSettings = new RussianGlobalization(); | |
//Calculate the formula | |
wb.CalculateFormula(); | |
//Save the workbook in pdf format | |
wb.Save("outputRussianGlobalization.pdf"); | |
} | |
} |