Lägg till ActiveX kontroller

Contents
[ ]

Följande kod exempel lägger till Toggle Button ActiveX-kontroll med Aspose.Cells för Python via .NET.

from aspose.cells import SaveFormat, Workbook
from aspose.cells.drawing.activexcontrols import ControlType
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Create workbook object
wb = Workbook()
# Access first worksheet
sheet = wb.worksheets[0]
# Add Toggle Button ActiveX Control inside the Shape Collection
s = sheet.shapes.add_active_x_control(ControlType.TOGGLE_BUTTON, 4, 0, 4, 0, 100, 30)
# Access the ActiveX control object and set its linked cell property
c = s.active_x_control
c.linked_cell = "A1"
# Save the worbook in xlsx format
wb.save(dataDir + "AddActiveXControls_out.xlsx", SaveFormat.XLSX)