由于太糟糕的原因,我希望能够在Wine下执行MS Office Automation。但是,下面的noddy程序无法从WinWord的实例中获取文档对象,尽管该文档已经由Wine在Wine下成功打开。linux wine Word interop application.Documents.Open打开Word中的文档,但不会将文档返回给客户端
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年
的酒版内置的葡萄酒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_6 4 x86_64的x86_64的GNU/Linux的
中央处理器Intel(R)核心(TM)2双CPU T9400 @ 2.53GHz的