Update Days Preserving History of Revision Logs in Shared Workbook with Node.js via C++

Possible Usage Scenarios

When you share a workbook, you get an option saying Keep change history for N days as shown in the following screenshot. You can update the number of days for preserving history using Aspose.Cells for Node.js via C++ with the WorksheetCollection.getDaysPreservingHistory() property.

todo:image_alt_text

Update Days Preserving History of Revision Logs in Shared Workbook

The following sample code creates an empty workbook, then shares it and updates the revision logs' days‑preserving‑history to 7 days (the default is normally 30 days). Please see the output Excel file generated by the code for reference.

Sample Code

const AsposeCells = require("aspose.cells.node");
const path = require("path");

// Create empty workbook
const workbook = new AsposeCells.Workbook();

// Share the workbook
workbook.getSettings().setShared(true);

// Update DaysPreservingHistory of RevisionLogs
workbook.getWorksheets().getRevisionLogs().setDaysPreservingHistory(7);

// Save the workbook
workbook.save("outputShared_DaysPreservingHistory.xlsx");