Specify Document Version of the Excel File using Built‑In Document Properties with C++

Possible Usage Scenarios

You can change the Version number of an Excel file by right‑clicking the file, selecting Properties > Details, and then editing the Version number field. Please use the BuiltInDocumentPropertyCollection.SetDocumentVersion() method to change it programmatically using the Aspose.Cells APIs.

Specify Document Version of the Excel File using Built‑In Document Properties

The following sample code creates a workbook and changes its built‑in document properties that include Title, Author, and Version number. Please see the output Excel file generated by the code and the screenshot that shows the modified Version number by the BuiltInDocumentPropertyCollection.SetDocumentVersion() property.

todo:image_alt_text

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();
}