在命名范围公式中支持德语语言环境

Contents
[ ]

英文公式写入命名区域。可以在系统配置为德语区域设置的环境中打开此 Excel 文件,但应将英语公式翻译为德语。以下示例演示了此功能,但是,它需要以德语安装 Excel,并且系统区域设置也应设置为德语。

可以从以下链接下载用于测试此功能的示例文件:

示例命名范围测试.xlsm

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// Define variables
String name = "HasFormula";
String value = "=GET.CELL(48, INDIRECT(\"ZS\",FALSE))";
// Load the template file
Workbook wbSource = new Workbook(srcDir + "sampleNamedRangeTest.xlsm");
// Get the worksheets collection
WorksheetCollection wsCol = wbSource.getWorksheets();
// Add new name to the names collection
int nameIndex = wsCol.getNames().add(name);
// Set value to the named range
Name namedRange = wsCol.getNames().get(nameIndex);
namedRange.setRefersTo(value);
// Save the output file
wbSource.save(outDir + "sampleOutputNamedRangeTest.xlsm");