ActiveX

يوضح كيفية إضافة، الوصول، إزالة وتكوين عناصر تحكم ActiveX في عرض تقديمي باستخدام Aspose.Slides for PHP via Java.

إضافة عنصر تحكم ActiveX

إدراج عنصر تحكم ActiveX جديد.

function addActiveX() {
    $presentation = new Presentation();
    try {
        $slide = $presentation->getSlides()->get_Item(0);

        // إضافة عنصر تحكم ActiveX جديد.
        $control = $slide->getControls()->addControl(ControlType::WindowsMediaPlayer, 50, 50, 100, 50);

        $presentation->save("activex.pptm", SaveFormat::Pptm);
    } finally {
        // تحرير العرض التقديمي.
        $presentation->dispose();
    }
}

الوصول إلى عنصر تحكم ActiveX

قراءة المعلومات من أول عنصر تحكم ActiveX على الشريحة.

function accessActiveX() {
    $presentation = new Presentation("activex.pptm");
    try {
        $slide = $presentation->getSlides()->get_Item(0);

        // الوصول إلى أول عنصر تحكم ActiveX.
        $control = $slide->getControls()->get_Item(0);

        echo "Control Name: " . $control->getName() . PHP_EOL;
    } finally {
        // تحرير العرض التقديمي.
        $presentation->dispose();
    }
}

إزالة عنصر تحكم ActiveX

حذف عنصر تحكم ActiveX موجود من الشريحة.

function removeActiveX() {
    $presentation = new Presentation("activex.pptm");
    try {
        $slide = $presentation->getSlides()->get_Item(0);

        if (java_values($slide->getControls()->size()) > 0) {
            // إزالة أول عنصر تحكم ActiveX.
            $slide->getControls()->removeAt(0);
        }

        $presentation->save("activex_removed.pptm", SaveFormat::Pptm);
    } finally {
        // تحرير العرض التقديمي.
        $presentation->dispose();
    }
}

تعيين خصائص ActiveX

تكوين عدة خصائص لـ ActiveX.

function setActiveXProperties() {
    $presentation = new Presentation("activex.pptm");
    try {
        $slide = $presentation->getSlides()->get_Item(0);

        // افتراض أن العنصر الأول هو الذي أضفناه.
        $control = $slide->getControls()->get_Item(0);

        // تكوين الخصائص.
        $control->getProperties()->set_Item("Caption", "Click Me");
        $control->getProperties()->set_Item("Enabled", "true");

        $presentation->save("activex_properties.pptm", SaveFormat::Pptm);
    } finally {
        // تحرير العرض التقديمي.
        $presentation->dispose();
    }
}