When I run the following code from Visual Studio, (debug) from my aspx page, everything works out as planned, but when I publish the site, the WINWORD.EXE process starts on the server and nothing else happens. I want to use this COM interop
to find and replace certain fields in this word document, and then print to pdf.
Warren DuBoi...
0 Points
2 Posts
using Microsoft.Office.Interop.Word on ASP.NET server starts process, but hangs
Apr 25, 2008 08:29 PM|LINK
When I run the following code from Visual Studio, (debug) from my aspx page, everything works out as planned, but when I publish the site, the WINWORD.EXE process starts on the server and nothing else happens. I want to use this COM interop to find and replace certain fields in this word document, and then print to pdf.
PLEASE HELP!!!
object filename = Worddoc; object readOnly = false; object isVisible = true; object missing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.ApplicationClass wordapp = new Microsoft.Office.Interop.Word.ApplicationClass();wordapp.Visible =
true; Microsoft.Office.Interop.Word.Document oWordDoc = wordapp.Documents.Open(ref filename, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); int x = 0;oWordDoc.Activate();
foreach (String fnd in Find){
object find = fnd; object replace = Replace[x]; object reptrue = true; //do find wordapp.Selection.Find.Execute(ref find, ref reptrue, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref replace, ref reptrue, ref missing,ref missing, ref missing, ref missing);x++;
}
Thanks in advance!