Excel error values in another language

Hello,

I wanted to know how to get exactly the displayed values (see excelvalues.png (1.6 KB)). Normally I would use DisplayStringValue but since it’s a standard Excel value, I’m not sure anymore.

When I read it out I get the English terms instead.

#NAME!; #VALUE!; #REF!

Thank you

@asdf.zxc

DisplayStringValue is the most good option because it takes care of conditional formatting as well. StringValue is good when you need string value as displayed inside the cell but with no conditional formatting effect.

You can change the error values or other such things using the GlobalizationSettings class. Override its necessary functions and it will suit your needs.

Please see the following code, it will replace “#VALUE!” with “MyError”.

C#

class gb : GlobalizationSettings
{
	public override string GetErrorValueString(string err)
	{
		return "MyError";
	}

}

static void Run()
{
	Workbook wb = new Workbook("sample.xlsx");

	wb.Settings.GlobalizationSettings = new gb();

	wb.CalculateFormula();

	wb.Save("output.pdf");
}

Reference Articles

1 Like