支持在命名范围公式中使用德国区域设置
Contents
[
Hide
]
英语公式写入命名区域。该 Excel 文件可以在系统配置为德语区域设置的环境中打开,但是英语公式将被翻译成德语。以下示例演示了此功能,但需要在德语语言中安装 Excel 并将系统区域设置也设置为德语。
可从以下链接下载用于测试此功能的示例文件:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |