Aspose.Cells Kullanarak AktifX Kontrolleri Ekleme
Aspose.Cells ile ActiveX kontrolleri ekleyebilirsiniz ShapeCollection.addActiveXControl() yöntemi ile. Bu yöntem, bir çalışma sayfası içinde hangi türde ActiveX kontrolün eklenmesi gerektiğini söyleyen ControlType parametresini alır. Aşağıdaki değerlere sahiptir.
- CHECK_BOX
- COMBO_BOX
- COMMAND_BUTTON
- IMAGE
- LABEL
- LIST_BOX
- RADIO_BUTTON
- SCROLL_BAR
- DÖNDÜRME_DÜĞMESİ
- METİN_KUTUSU
- ANAHTAR_DÜĞMESİ
- BİLİNMEYEN
AktifX kontrolünü şekil koleksiyonuna ekledikten sonra, Shape.ActiveXControl özelliği üzerinden AktifX kontrol nesnesine erişebilir ve çeşitli özelliklerini ayarlayabilirsiniz.
Aspose.Cells kullanarak Anahtar Düğmesi AktifX Kontrolü ekleme
Aşağıdaki örnek kod, Aspose.Cells kullanarak Anahtar Düğmesi AktifX Kontrolü ekler. Bu kod ile oluşturulan çıktı excel dosyasını referansınız için indirebilirsiniz.
// 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); |