我在php中尝试了catch语句,但在运行后我收到了一些错误
异常'com_exception',消息'参数0:类型不匹配。 “ 在C:\ Program Files中 (86)\的EasyPHP-DevServer-13.1VC9 \数据\ localweb \ AutomationDocumentation \ doccreation.php:218 堆栈跟踪:#0 C:\ Program Files (86)\的EasyPHP-DevServer-13.1VC9 \数据\ localweb \ AutomationDocumentation \ doccreation.php(218): variant-> Open(false)#1 {main}
下面是我的代码:
try{
$word = new COM("Word.Application") or die ("Could not initialise Object.");
// set it to 1 to see the MS Word window (the actual opening of the document)
$word->Visible = 0;
echo "Anish";
$path=realpath("C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\AutomationDocumentation/$releasedoc/$releasedocfile.docx");
//echo $path;
// recommend to set to 0, disables alerts like "Do you want MS Word to be the default .. etc"
$word->DisplayAlerts = 0;
// open the word 2007-2013 document
$word->Documents->Open($path);
$a="hello";
// convert word 2007-2013 to PDF
$word->ActiveDocument->ExportAsFixedFormat("C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\AutomationDocumentation\$created/$mainfolder/$releasedoc/$releasedocfile.pdf", 17, false, 0, 0, 0, 0, 7, true, true, 2, true, true, false);
// quit the Word process
$word->Quit(false);
// clean up
unset($word);
}catch(Exception $e){
echo $e;
}