ActiveX

프레젠테이션에서 Aspose.Slides for PHP via Java를 사용하여 ActiveX 컨트롤을 추가, 액세스, 제거 및 구성하는 방법을 보여줍니다.

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();
    }
}