Two question about Word and Delphi.--sorry,my Chinese IME do esn't work correctly

  • 主题发起人 主题发起人 Lera
  • 开始时间 开始时间
L

Lera

Unregistered / Unconfirmed
GUEST, unregistred user!
Two question about Word and Delphi.--sorry,my Chinese IME doesn't work correctly.(100分)<br />1.How to tell my Variant Object(Word.basic) know the MS Word Server is closed?
I create this variant object in the following codes:
//Vword has implemented as a public variant;
if VarIsEmpty(Vword) then
begin
Vword:=CreateOleObject('Word.Basic');
VWord.Filenew;
Vword.AppShow;
end;
when i closed the Word manually, this Vword will not free correctly,why?

2.How can this Variant Object perform Wrting a hyperlink to MS word?
i have successfully insert a hyperlink field into word in this variant.it show the
URL as its title.but I want to use another Title,so I want to use another command,
so how to insert a hyperlink into it? i don't know the parameters and their
types of related WordBasic commands.I want to get some codes as example.

pls help me.
50 points for each question,and excellent answer will got more beyond these 100.
Thanks.

 
Nobody want to answer?
 
我现在把它翻译成中文,请高手赐教:
1.我用变体创建了一个Word.Basic对象,当Word显示后如果用户关闭了它,
这个变体有办法知道它已经关闭了吗?
2.继续上一情况,使用这种以变体创建的Word.Basic对象,应该如何向WORD当前的活动文档
中插入一个超级链接?最好是显示的文字与URL文本不一样的超级链接?

愿意出100分乃至更多征求这两个问题的解答.
 
请版主帮我结束这个问题,
竟然没有一个人能回答,气死我了.
 
1、有个笨办法
OnTimer1
ActiveWord:Variant;
begin
ActiveWord:=GetActiveOleObject('word.application');
if ActiveWord=nil
//word close
else
//word not close
end;

2、
我可能理解有误
if VarIsEmpty(Vword) then
begin
Vword:=CreateOleObject('Word.Basic');
VWord.Filenew;
Vword.AppShow;
Vword.ActiveDocumt.......
处理就可以了
你还想怎么样。。
end;
对了你的中文比较差,还不如英文好
 
to cnaoszh:
第一个对我有参考价值。
第二个问题我写的代码前几行就是你那个样子,
具体困难在于后面插入超链接的VBA代码。我不知道它的参数情况。
事实上如果用域来实现,我做成功过。代码为:
Vword.insertfieldchar;
Vword.InsertText("Hyperlink http://www.google.com");
这样的问题在于显示出来的超链接标题也是http://www.google.com.
我想做到 标题与URL 不一样.所以我想使用Vword.insertHyperLink 这一语句,
问题就在于我没有它的参数类型信息.而变体不支持这种情况下的语法检查.

欢迎再有人回答.
 
接受答案了.
 
后退
顶部