C# linux wine Word interop application.Documents.Open在Word中打开文档,但不会将文档返回给客户端

C# linux wine Word interop application.Documents.Open在Word中打开文档,但不会将文档返回给客户端,c#,linux,office-interop,wine,C#,Linux,Office Interop,Wine,出于可怕的原因,我想在Wine下实现MS办公自动化。但是,下面的noddy程序无法从WinWord实例获取document对象,尽管WinWord在wine下运行时已成功打开了文档 using System; using System.Collections.Generic; using System.Text; using Microsoft.Office.Interop.Word; // This code is lifted from http://www.dotnetperls.com

出于可怕的原因,我想在Wine下实现MS办公自动化。但是,下面的noddy程序无法从WinWord实例获取document对象,尽管WinWord在wine下运行时已成功打开了文档

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

// This code is lifted from http://www.dotnetperls.com/word

namespace WordTest
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Usage WordTest word.doc");
                return;
            }
            String docname = args[0];
            try
            {
                Application application = new Application();
                Document document = application.Documents.Open(docname);

                // Loop through all words in the document. (We get an exception here)
                int count = document.Words.Count;
                for (int i = 1; i <= count; i++)
                {
                    // Write the word.
                    string text = document.Words[i].Text;
                    Console.WriteLine("Word {0} = {1}", i, text);
                }
                // Close word.
                application.Quit();
           }
           catch (Exception e)
           {
                Console.WriteLine("Exception {0}\nStacktrace\n{1}", e.Message, e.StackTrace);

           }
       }
   }
}
使用系统;
使用System.Collections.Generic;
使用系统文本;
使用Microsoft.Office.Interop.Word;
//此代码是从http://www.dotnetperls.com/word
名称空间字测试
{
班级计划
{
静态void Main(字符串[]参数)
{
如果(参数长度<1)
{
Console.WriteLine(“Usage WordTest word.doc”);
返回;
}
字符串docname=args[0];
尝试
{
应用程序=新应用程序();
文档=应用程序.Documents.Open(docname);
//循环浏览文档中的所有单词。(这里有一个例外)
int count=document.Words.count;

对于(inti=1;i这是一种已知的葡萄酒缺陷

您可以在此处阅读更多内容: