62,039
社区成员
发帖
与我相关
我的任务
分享
Object Nothing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
Microsoft.Office.Interop.Word.Document WordDoc = WordApp.Documents.Open(path, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing);
Microsoft.Office.Interop.Word.Find findObject = WordApp.Selection.Find;//报错找不到Find(这个具体错误信息忘记了,应该是为将对象引用到实例)
String sSvrIp = null, sPort = null, sObjectUrl = null;
if (sSvrIp == null || sSvrIp == "")
sSvrIp = "localhost";
if (sPort == null || sPort == "")
sPort = "9000";
if (sObjectUrl == null || sObjectUrl == "")
sObjectUrl = "word";
IChannel chan = null;
if (ChannelServices.RegisteredChannels.Length > 0)
foreach (IChannel chan1 in ChannelServices.RegisteredChannels)
{
if (chan1.ChannelName == "wordtcp")
chan = chan1;
}
else
if (chan == null)
{
chan = new TcpClientChannel("wordtcp", new BinaryClientFormatterSinkProvider());
ChannelServices.RegisterChannel(chan, false);
}
word obj;
obj = (word)Activator.GetObject(typeof(word), "tcp://localhost:9000/word/WordExc");
obj.wordexc(path, cominfo, comaddinfo, ……………………);
return path;//obj.wordexc的返回值实际无用