با سلام
با اجرا كردن اين كد پيغام خطاي زير را نشان مي دهد
Loaded Word, version 11.0
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft Word Description: Could not open macro storage. in c:\inetpub\wwwroot\testcom.php on line 22
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft Word Description: The requested member of the collection does not exist. in c:\inetpub\wwwroot\testcom.php on line 32
Word closed.
و فايل word مرد نظر را نمي سازد مشكل از چيست؟
$_GET['YourName']="test";
$_GET['YourAge']="25";
// Used as a placeholder in certain COM functions where no parameter is required.
$empty = new VARIANT();
// Load the appropriate type library.
com_load_typelib('Word.Application');
// Create an object to use.
$word = new COM('word.application') or die('Unable to load Word');
print "Loaded Word, version {$word->Version}\n";
// Open a new document with bookmarks of YourName and YourAge.
$word->Documents->Open('C:\test\mark.doc');
// Fill in the information from the form.
$word->Selection->GoTo(wdGoToBookmark,$empty,$empty,'YourName'); // Note use of wdGoToBookmark, from the typelibrary and the use of $empty.
$word->Selection->TypeText($_GET['YourName']); //$_GET['YourName']
$word->Selection->GoTo(wdGoToBookmark,$empty,$empty,'YourAge');
$word->Selection->TypeText($_GET['YourAge']);
// Save it, close word and finish.
$word->Documents[1]->SaveAs("C:\test\mark3.doc");
$word->Quit();
$word->Release();
$word = null;
print "Word closed.\n".$_GET['YourName'];
?>
با اجرا كردن اين كد پيغام خطاي زير را نشان مي دهد
Loaded Word, version 11.0
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft Word Description: Could not open macro storage. in c:\inetpub\wwwroot\testcom.php on line 22
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft Word Description: The requested member of the collection does not exist. in c:\inetpub\wwwroot\testcom.php on line 32
Word closed.
و فايل word مرد نظر را نمي سازد مشكل از چيست؟
$_GET['YourName']="test";
$_GET['YourAge']="25";
// Used as a placeholder in certain COM functions where no parameter is required.
$empty = new VARIANT();
// Load the appropriate type library.
com_load_typelib('Word.Application');
// Create an object to use.
$word = new COM('word.application') or die('Unable to load Word');
print "Loaded Word, version {$word->Version}\n";
// Open a new document with bookmarks of YourName and YourAge.
$word->Documents->Open('C:\test\mark.doc');
// Fill in the information from the form.
$word->Selection->GoTo(wdGoToBookmark,$empty,$empty,'YourName'); // Note use of wdGoToBookmark, from the typelibrary and the use of $empty.
$word->Selection->TypeText($_GET['YourName']); //$_GET['YourName']
$word->Selection->GoTo(wdGoToBookmark,$empty,$empty,'YourAge');
$word->Selection->TypeText($_GET['YourAge']);
// Save it, close word and finish.
$word->Documents[1]->SaveAs("C:\test\mark3.doc");
$word->Quit();
$word->Release();
$word = null;
print "Word closed.\n".$_GET['YourName'];
?>