R
Raul
Hi there,
I have a C# app that calls Office.Inetrop.Word to do Mail Merge. Calling the
word object from an app with GUI is Ok, but when I decided to move the code
to a service, it gets stuck in Word.Open function.
I have a template that I open, and then do mail merge on it to fax it.
Is there any known problem with word object and services?
pieces of the code
using Word = Microsoft.Office.Interop.Word;
// word object creation
_oWordApp = new Word.Application();
_oWord.ActivePrinter = "fax";
// openening the doc
object missing System.Reflection.MissingValue;
object oDocName = "word template name.doc";
_oWordDoc = _oWordApp.Documents.Open(ref oDocName, ref missing, ref missing,
ref missing, ref missing,
ref missing,
ref missing, ref missing,
ref missing,
ref missing, ref missing,
ref missing,
ref missing, ref missing,
ref missing,
ref missing);
_oWordDoc.Select();
// mail merge
_oWordDoc.MailMerge.OpenDataSource("source name", ref missing,......)
// select the doc and merge
_oWordSelection = _oWordApp.Selection;
_oWordMailMerge = _oWordDoc.MailMerge;
// print it
_oWordMailMerge.Destination = Word.WdMailMergeDestination.wdSendToPrinter;
_oWordMailMerge.Execute(false);
// close doc
// close app
Best regards,
raul.
I have a C# app that calls Office.Inetrop.Word to do Mail Merge. Calling the
word object from an app with GUI is Ok, but when I decided to move the code
to a service, it gets stuck in Word.Open function.
I have a template that I open, and then do mail merge on it to fax it.
Is there any known problem with word object and services?
pieces of the code
using Word = Microsoft.Office.Interop.Word;
// word object creation
_oWordApp = new Word.Application();
_oWord.ActivePrinter = "fax";
// openening the doc
object missing System.Reflection.MissingValue;
object oDocName = "word template name.doc";
_oWordDoc = _oWordApp.Documents.Open(ref oDocName, ref missing, ref missing,
ref missing, ref missing,
ref missing,
ref missing, ref missing,
ref missing,
ref missing, ref missing,
ref missing,
ref missing, ref missing,
ref missing,
ref missing);
_oWordDoc.Select();
// mail merge
_oWordDoc.MailMerge.OpenDataSource("source name", ref missing,......)
// select the doc and merge
_oWordSelection = _oWordApp.Selection;
_oWordMailMerge = _oWordDoc.MailMerge;
// print it
_oWordMailMerge.Destination = Word.WdMailMergeDestination.wdSendToPrinter;
_oWordMailMerge.Execute(false);
// close doc
// close app
Best regards,
raul.