Skip to end of metadata
Go to start of metadata

English formulae are written into named region. This Excel file can be opened in an environment where system is configured to German Locale however the English formula shall be translated to German language. Following example demonstrates this feature, however it requires Excel to be installed in German language and system locale shall be set to German as well.

Sample file for testing this feature can be downloaded from the following link:

sampleNamedRangeTest.xlsm

 

// Define variables
const string name = "HasFormula";
const string value = "=GET.CELL(48, INDIRECT(\"ZS\",FALSE))";
 
// Load the template file
Workbook wbSource = new Workbook(sourceDir + "sampleNamedRangeTest.xlsm");
 
// Get the worksheets collection
WorksheetCollection wsCol = wbSource.Worksheets;
 
// Add new name to the names collection
int nameIndex = wsCol.Names.Add(name);
 
// Set value to the named range
Name namedRange = wsCol.Names[nameIndex];
namedRange.RefersTo = value;
 
// Save the output file
wbSource.Save(outputDir + "sampleOutputNamedRangeTest.xlsm");
 

 

Labels
  • No labels