misterstick
Programmer
i'm creating a document in Word from C#.
the first forty or so paragraphs are written very quickly, less than a second for all of them, but after that it slows right down to about four seconds per paragraph, and gets slower as more are added.
any ideas on how to speed things up a bit?
many thanks,
mr s. <
the first forty or so paragraphs are written very quickly, less than a second for all of them, but after that it slows right down to about four seconds per paragraph, and gets slower as more are added.
any ideas on how to speed things up a bit?
Code:
object nullParameter = Type.Missing;
Word._Application application = new Word.Application();
Word.Document document = application.Documents.Add(ref nullParameter, ...);
string[] paragraphs = ArbitraryArrayOfStrings();
foreach ( string paragraph in paragraphs )
{
document.Paragraphs[document.Paragraphs.Count].Range.InsertAfter(paragraph);
document.Paragraphs[document.Paragraphs.Count].Range.InsertParagraphAfter();
}
object fileName = passedFromElseWhere;
document.SaveAs(ref fileName, ref nullParameter, ...);
document.Close(ref nullParameter, ref nullParameter, ref nullParameter);
application.Quit(ref nullParameter, ref nullParameter, ref nullParameter);
many thanks,
mr s. <