[英]Open Microsoft Word using PHP
我使用下面的代码为PhP中的Microsoft word设置了一个名为“ Text1”的表单字段,但是在$word->Documents->Open('C:/Doc1.doc');
行出现了错误$word->Documents->Open('C:/Doc1.doc');
,即Cannot pass parameter 1 by reference
如下所示,这是什么问题?
<?php
com_load_typelib('Word.Application');
$word = new COM("word.application");
$word->Documents->Open('C:/Doc1.doc');
$word->Visible = 1;
$word->ActiveDocument->FormFields("Text1")->Result = "something";
$word->ActiveDocument->Close(false);
$word->Quit();
unset($word);
?>
$ word-> Documents-> Open被声明为需要通过引用传递的参数,并且不能使用字符串文字进行调用。
你需要 :
$docName='C:/Doc1.doc';
$word->Documents->Open($docName);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.