R
Ram
I am writing a C# application which performs MailMerge
(programtically) for users using Word 2003(Sample below).
Question is that, is Microsoft.Office.Interop.Word the only way of
accessing Word objects. Is there any other way inherent for .NET
environment?
************************************************
using Microsoft.Office.Interop.Word;
public function Foo()
{
Microsoft.Office.Interop.Word.Application wrdApp;
Microsoft.Office.Interop.Word.Document wrdDoc;
//Create an instance of Word, and make it invisible
wrdApp = new Microsoft.Office.Interop.Word.Application();
wrdApp.Visible = false;
//Open the template
object strFileName = "C:\\Test\\TestDoc.doc";
object optional = Missing.Value;
wrdDoc = wrdApp.Documents.Open(ref strFileName,
ref optional,ref optional,ref optional,ref optional,ref optional,ref
optional,
ref optional,ref optional, ref optional,ref optional,ref optional,ref
optional,
ref optional,ref optional,ref optional);
//set the Data File
string strDataFileName = "C:\\Test\\TestDataFile.CSV";
wrdDoc.MailMerge.OpenDataSource(strDataFileName, ref optional, ref
optional, ref optional, ref optional,
ref optional, ref optional, ref optional, ref optional, ref optional,
ref optional,
ref optional, ref optional, ref optional, ref optional, ref optional);
//Perform Merge
wrdDoc.MailMerge.Execute(ref optional);
object blnSave = false;
wrdDoc.Close(ref blnSave, ref optional, ref optional);
wrdApp.Quit(ref optional, ref optional, ref optional);
}
****************************************************
(programtically) for users using Word 2003(Sample below).
Question is that, is Microsoft.Office.Interop.Word the only way of
accessing Word objects. Is there any other way inherent for .NET
environment?
************************************************
using Microsoft.Office.Interop.Word;
public function Foo()
{
Microsoft.Office.Interop.Word.Application wrdApp;
Microsoft.Office.Interop.Word.Document wrdDoc;
//Create an instance of Word, and make it invisible
wrdApp = new Microsoft.Office.Interop.Word.Application();
wrdApp.Visible = false;
//Open the template
object strFileName = "C:\\Test\\TestDoc.doc";
object optional = Missing.Value;
wrdDoc = wrdApp.Documents.Open(ref strFileName,
ref optional,ref optional,ref optional,ref optional,ref optional,ref
optional,
ref optional,ref optional, ref optional,ref optional,ref optional,ref
optional,
ref optional,ref optional,ref optional);
//set the Data File
string strDataFileName = "C:\\Test\\TestDataFile.CSV";
wrdDoc.MailMerge.OpenDataSource(strDataFileName, ref optional, ref
optional, ref optional, ref optional,
ref optional, ref optional, ref optional, ref optional, ref optional,
ref optional,
ref optional, ref optional, ref optional, ref optional, ref optional);
//Perform Merge
wrdDoc.MailMerge.Execute(ref optional);
object blnSave = false;
wrdDoc.Close(ref blnSave, ref optional, ref optional);
wrdApp.Quit(ref optional, ref optional, ref optional);
}
****************************************************