PHP COM MS Word应用程序 [英] PHP COM MS Word Application

查看:94
本文介绍了PHP COM MS Word应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在这里的第一篇文章 - 耶!这是我正在调用的函数(只是传递测试参数):

展开 | 选择 | Wrap < span class =codeDivider> | 行号

解决方案

< blockquote>嗨斯科特。欢迎来到Bytes!


首先,典型数组的第一个索引是0,所以你可能想要这样做:

展开 | 选择 | Wrap | 行号


谢谢Atli,


我改变了第93行(现在第95行,或第14行,从第一篇文章的代码片段开始)所以它现在读取:


word-> Documents [0] - > SaveAs(" test.doc");

我觉得奇怪的是它正在访问数组的第二个元素。


现在当我打电话给fu nction(在我的本地机器上)我得到了这个:


已加载的Word,版本12.0

致命错误:未捕获的异常''com_exception''带有消息' < b取代;来源:其中/ b个Microsoft Word< br />< b>说明:< / b>集合中请求的成员不存在。''在C:\ wamp \\\\ ... \docgen.php:95堆栈跟踪:#0 C:\ wamp \\\\ .. .\docgen.php(95):makedoc()#1 C:\ wamp \\\\ ... \\\ docs.php(25):makedoc(''Scott'',''冬天的时候。'')#9 {main}在第95行C:\ wamp \\\ ... \ dococ.php中抛出


以防万一''相关的第25行读作:makedoc(Scott,Time for winter。);这就是调用函数的地方。


我能解决什么?


再次感谢,

- Scott


This is my first post here - yay! This is my function that I am calling (just passing test arguments):

Expand|Select|Wrap|Line Numbers

解决方案

Hi Scott. Welcome to Bytes!

Firstly, the first index of a typical array is 0, so you would probably want to do:

Expand|Select|Wrap|Line Numbers


Thanks Atli,

I changed line 93 (now line 95, or line 14 from the snippet in my first post) so it now reads:


word->Documents[0]->SaveAs("test.doc");

I thought it was strange that it was accessing the second element of the array.

Now when I call the function (on my local machine still) I get this:

Loaded Word, version 12.0
Fatal error: Uncaught exception ''com_exception'' with message ''<b>Source:</b> Microsoft Word<br/><b>Description:</b> The requested member of the collection does not exist.'' in C:\wamp\www\...\docgen.php:95 Stack trace: #0 C:\wamp\www\...\docgen.php(95): makedoc() #1 C:\wamp\www\...\docgen.php(25): makedoc(''Scott'', ''Time for winter.'') #2 {main} thrown in C:\wamp\www\...\docgen.php on line 95

Just in case it''s relevant line 25 reads: makedoc("Scott","Time for winter."); which is just where the function is called from.

What can I fix?

Thanks again,
- Scott


这篇关于PHP COM MS Word应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆