I’m creating word documents from templates (.dot) via Microsoft.Office.Interop.Word. The code below works on some templates but not on others: where it doesn’t work it throws an RPC_E_SERVERFAULT exception. What is this about, what can be the cause, and how could I fix it? (The exception occurs on the second line.)
wordApp = new Microsoft.Office.Interop.Word.ApplicationClass(); wordDoc = wordApp.Documents.Add(ref oTemplate, ref newTemplate, ref docType, ref isVisible); wordApp.Visible = false; wordDoc.Activate();
You will hate me and downvote me probably but in all my .NET work experience working with the COM Interop is a PIA (pun intended / PIA also means Primary Interop Assemblies).
Usually the performance is so bad that makes the whole thing unacceptable. So we resorted to buying a 3rd party, managed, non-Office-dependent library that does the same thing WAY faster.