3

あまりにも恐ろしい理由で、Wine の下で MS Office Automation を実行できるようにしたいと考えています。しかし、下記の noddy プログラムは WinWord のインスタンスからドキュメント オブジェクトを取得できませんが、文書は Wine で実行されている WinWord によって正常に開かれています。

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);

           }
       }
   }
}

私がこのようなものを (上記の単純なコードではなく) 使用しようとしているのは、OpenOffice や Apache POI などを使用して行うことはできません。

何か案は?

これは関連している可能性があります:

このアプリケーションが構築されている .NET のバージョンは 2 です

WinWord のバージョンは 2007 です

ワインのバージョンはwine-1.5.6

Linux のディストリビューションは openSUSE 12.2

Linux バージョン 3.4.47-2.38-desktop #1 SMP PREEMPT Fri May 31 20:17:40 UTC 2013 (3961086) x86_64 x86_64 x86_64 GNU/Linux

CPU Intel(R) Core(TM)2 Duo CPU T9400 @ 2.53GHz

4

1 に答える 1