用 C++ 使用内置文档属性指定Excel文件的语言
Contents
[
Hide
]
可能的使用场景
你可以通过右键点击文件,选择 属性 > 详细信息,并编辑“语言”字段,来更改Excel文件的语言。请使用 BuiltInDocumentPropertyCollection.GetLanguage() 属性通过 Aspose.Cells API 以编程方式更改。
使用内置文档属性指定Excel文件的语言
以下示例代码创建一个工作簿,并更改其名为“Language”的内置文档属性。请查看由此代码生成的输出Excel文件,以及显示通过 BuiltInDocumentPropertyCollection.GetLanguage() 属性修改的“语言”字段的截图。
示例代码
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
using namespace Aspose::Cells::Properties;
int main()
{
Aspose::Cells::Startup();
// Create workbook object
Workbook wb;
// Access built-in document property collection
BuiltInDocumentPropertyCollection bdpc = wb.GetBuiltInDocumentProperties();
// Set the language of the Excel file
bdpc.SetLanguage(u"German, French");
// Save the workbook in xlsx format
wb.Save(u"..\\Data\\02_OutputDirectory\\outputSpecifyLanguageOfExcelFileUsingBuiltInDocumentProperties.xlsx", SaveFormat::Xlsx);
std::cout << "Language set successfully!" << std::endl;
Aspose::Cells::Cleanup();
}