Aspose.Cells'i kullanarak ActiveX Denetimleri ekleyin
Contents
[
Hide
]
ActiveX denetimlerini Aspose.Cells ile ekleyebilirsiniz.ShapeCollection.addActiveXControl() yöntem. Bu metot bir parametre alır.Kontrol tipibir çalışma sayfasına ne tür ActiveX denetimi eklenmesi gerektiğini söyler. Aşağıdaki değerlere sahiptir.
- KONTROL KUTUSU
- AÇILAN KUTU
- COMMAND_BUTTON
- GÖRÜNTÜ
- ETİKET
- LİSTE KUTUSU
- RADYO DÜĞMESİ
- KAYDIRMA ÇUBUĞU
- SPIN_BUTTON
- METİN KUTUSU
- TOGGLE_BUTTON
- BİLİNMEYEN
ActiveX denetimini şekil koleksiyonunun içine ekledikten sonra, ActiveX denetim nesnesine şu şekilde erişebilirsiniz:Shape.ActiveXControl özellik ve ardından çeşitli özelliklerini ayarlayın.
Aspose.Cells’i kullanarak Geçiş Düğmesi ActiveX Denetimi ekleyin
Aşağıdaki örnek kod, Aspose.Cells kullanarak Geçiş Düğmesi ActiveX Denetimi’ni ekler. Lütfençıktı excel dosyası referansınız için bu kodla oluşturulmuştur.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(AddActiveXControl.class); | |
// Create workbook object | |
Workbook wb = new Workbook(); | |
// Access first worksheet | |
Worksheet sheet = wb.getWorksheets().get(0); | |
// Add Toggle Button ActiveX Control inside the Shape Collection | |
Shape s = sheet.getShapes().addActiveXControl(ControlType.TOGGLE_BUTTON, 4, 0, 4, 0, 100, 30); | |
// Access the ActiveX control object and set its linked cell property | |
ActiveXControl c = s.getActiveXControl(); | |
c.setLinkedCell("A1"); | |
// Save the worbook in xlsx format | |
wb.save(dataDir + "output.xlsx", SaveFormat.XLSX); |