移除ActiveX控件

移除ActiveX控件

Aspose.Cells 提供了从工作簿中移除 ActiveX 控件的功能。为此,API 提供了 Shape.RemoveActiveXControl 方法。以下代码片段演示了使用 Shape.RemoveActiveXControl 方法移除 ActiveX 控件的用法。

示例代码

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Source directory
string sourceDir = RunExamples.Get_SourceDirectory();
//Output directory
string outputDir = RunExamples.Get_OutputDirectory();
// Create a workbook
Workbook wb = new Workbook(sourceDir + "sampleUpdateActiveXComboBoxControl.xlsx");
// Access first shape from first worksheet
Shape shape = wb.Worksheets[0].Shapes[0];
// Access ActiveX ComboBox Control and update its value
if (shape.ActiveXControl != null)
{
// Remove Shape ActiveX Control
shape.RemoveActiveXControl();
}
// Save the workbook
wb.Save(outputDir + "RemoveActiveXControl_our.xlsx");