使用 C++ 移除 ActiveX 控件
Contents
[
Hide
]
移除ActiveX控件
Aspose.Cells 提供了从工作簿中移除 ActiveX 控件的功能。为此,API 提供了 Shape.RemoveActiveXControl 方法。以下代码片段演示了如何使用 Shape.RemoveActiveXControl 方法移除 ActiveX 控件。
示例代码
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Source directory path
U16String srcDir(u"..\\Data\\01_SourceDirectory\\");
// Output directory path
U16String outDir(u"..\\Data\\02_OutputDirectory\\");
// Create a workbook
Workbook wb(srcDir + u"sampleUpdateActiveXComboBoxControl.xlsx");
// Access first shape from first worksheet
Shape shape = wb.GetWorksheets().Get(0).GetShapes().Get(0);
// Remove Shape ActiveX Control
shape.RemoveActiveXControl();
// Save the workbook
wb.Save(outDir + u"RemoveActiveXControl_out.xlsx");
std::cout << "ActiveX Control removed successfully!" << std::endl;
Aspose::Cells::Cleanup();
}