dongmu1951 2015-11-20 05:20
浏览 162
已采纳

用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 08: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条)

报告相同问题?

悬赏问题

  • ¥15 matlab实现基于主成分变换的图像融合。
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊