使用Aspose.Cells用C++创建共享工作簿
Contents
[
Hide
]
可能的使用场景
Microsoft Excel允许您像在以下截图中所示共享工作簿。当您共享工作簿时,多个用户可以在网络上编辑此工作簿。Aspose.Cells使您能够使用Workbook.GetShared()属性创建共享工作簿。
使用Aspose.Cells创建共享工作簿
以下示例代码通过将Workbook.GetShared()属性设置为true,创建一个共享工作簿。当您在Microsoft Excel中打开输出Excel文件时,您将看到共享与输出工作簿的名称,如截图所示。
示例代码
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C
// Create Workbook object
std::unique_ptr<Workbook> wb = std::make_unique<Workbook>();
// Share the Workbook
wb->GetSettings().SetShared(true);
// Save the Shared Workbook
wb->Save(u"outputSharedWorkbook.xlsx");
std::cout << "Shared workbook saved successfully!" << std::endl;
Aspose::Cells::Cleanup();
}