Ich benutze VS2005 und ich muss viele .doc-Dateien erstellen. Mein Computer (Intel c2d6600 mit 2GB RAM) kann mit 10 Dateien konvertieren/Minute ist es sehr langsam für mich. Was soll ich tun, um die Leistung zu verbessern?Sehr langsam interop mit Word in C# -Anwendung
Mein Code:
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() funktioniert langsam, aber ich habe viele dieser Operationen in jedem Dokument. :( – mystdeim