dongmu1951 2015-11-19 21:20
浏览 165
已采纳

用php找出Ppt文件的页码

I want to get the page numbers of ppt files. My Code:

$filename = "aaa.ppt";
$word = new COM("Powerpoint.Application");
$word->PresentationDocument->Open($filename);
$wdStatisticPages = 2; // Value that corresponds to the Page count in the Statistics
echo $word->ActivePresentation->SlideParts->Count($wdStatisticPages);  
$word->ActivePresentation->Close();
$word->Quit();

But it gives error:

Fatal error: Uncaught exception 'com_exception' with message 'Unable to lookup `PresentationDocument': Unknown name. '

  • 写回答

2条回答 默认 最新

  • dsfds4551 2015-11-20 00:09
    关注

    I got the answer, thanks Suyog for your efforts.

    $filename = "aaa.ppt";
    $power = new COM("Powerpoint.Application");
    $power->visible = True;
    $power->Presentations->Open(realpath($filename));
    echo $power->ActivePresentation->Slides->Count;  
    //$word->ActiveDocument->PrintOut();
    $power->ActivePresentation->Close();
    $power->Quit();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部