找出php的Ppt文件的页码
Find out page numbers of Ppt files with php
我想获取ppt文件的页码。
我的代码:
$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();
但是报错:
Fatal error: Uncaught exception 'com_exception' with message 'Unable
to lookup `PresentationDocument': Unknown name. '
这种问题是由以下因素造成的。
- PHP.ini 设置
- 文件/文件夹权限
- 服务器未启用允许打开
- 允许的上传大小
我得到答案了,感谢Suyog的努力。
$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();
我想获取ppt文件的页码。 我的代码:
$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();
但是报错:
Fatal error: Uncaught exception 'com_exception' with message 'Unable to lookup `PresentationDocument': Unknown name. '
这种问题是由以下因素造成的。
- PHP.ini 设置
- 文件/文件夹权限
- 服务器未启用允许打开
- 允许的上传大小
我得到答案了,感谢Suyog的努力。
$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();