我使用VS2005,我需要创建许多.doc文件。 我的电脑(英特尔c2d6600与2GB内存)可以转换为10个文件/分钟,这对我来说非常慢。 我应该怎么做才能提高性能?在c#应用程序中与Word非常缓慢的互操作
我的代码:
oWord = new Word.Application();
oMissing = System.Reflection.Missing.Value;
oDoc = this._oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
...
//Do something
...
//save rtf
object fileName = this.FileRtf;
object fileFormat = Word.WdSaveFormat.wdFormatRTF;
object savechanges = false;
oDoc.SaveAs(ref fileName, ref fileFormat, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
oWord.Quit(ref savechanges, ref oMissing, ref oMissing);
Word.Paragraph oPara; ...; oPara.Range.InsertParagraphAfter()的工作很慢,但我在每个文档中都有很多这样的操作。 :( – mystdeim 2010-12-03 09:55:01