I have try catch statement in php, but after running I am getting some error saying
exception 'com_exception' with message 'Parameter 0: Type mismatch. ' in C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\AutomationDocumentation\doccreation.php:218 Stack trace: #0 C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\AutomationDocumentation\doccreation.php(218): variant->Open(false) #1 {main}
below is my code:
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;
}