Specify Document Version of the Excel File using BuiltIn Document Properties with C++
Contents
[
Hide
]
Possible Usage Scenarios
You can change the Version number of an Excel file by right-clicking the file and then selecting Properties > Details and then editing the Version number field. Please use BuiltInDocumentPropertyCollection.GetDocumentVersion() property to change it programmatically using Aspose.Cells APIs.
Specify Document Version of the Excel File using BuiltIn Document Properties
The following sample code creates a workbook and changes its built-in document properties that include Title, Authors, and Version number. Please see the output Excel file generated by the code and screenshot that shows the modified Version number by BuiltInDocumentPropertyCollection.GetDocumentVersion() property.
Sample Code
#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();
}