BuiltInドキュメントプロパティを使用してExcelファイルのバージョンを指定するC++による方法
可能な使用シナリオ
Excelファイルのバージョン番号を変更するには、ファイルを右クリックし、[プロパティ]→[詳細]を選択し、バージョン番号の欄を編集してください。Aspose.Cells APIを使ってプログラムで変更するにはBuiltInDocumentPropertyCollection.GetDocumentVersion()プロパティを使用してください。
ビルドインドキュメントプロパティを使用してExcelファイルのドキュメントバージョンを指定する
次のサンプルコードは、ワークブックを作成し、そのビルトインドキュメントプロパティ(タイトル、作者、バージョン番号)を変更します。コードで生成された出力Excelファイルと、その中のバージョン番号がBuiltInDocumentPropertyCollection.GetDocumentVersion()プロパティによって変更されたスクリーンショットを確認してください。
サンプルコード
#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 title
bdpc.SetTitle(u"Aspose File Format APIs");
// Set the author
bdpc.SetAuthor(u"Aspose APIs Developers");
// Set the document version
bdpc.SetDocumentVersion(u"Aspose.Cells Version - 18.3");
// Save the workbook in xlsx format
wb.Save(u"outputSpecifyDocumentVersionOfExcelFile.xlsx", SaveFormat::Xlsx);
std::cout << "Document properties set and file saved successfully!" << std::endl;
Aspose::Cells::Cleanup();
}