1

I am looking to do a mail merge in Word using their interop libraries. However having issues getting word installed on my developer machine due to IT at work.

Is it possible to programmatically interact with OpenOffice as an alternative? Ideally in C#

2 Answers 2

2

There are a handful of third-party C# libraries that can do this, such as OfficeWriter (who I work for) and others.

Using the library and your Word document you simply call a method, passing in the data to be mail merged. The API is usually pretty strait forward:

using (WordTemplate wordTemplate = new WordTemplate())
{
    wordTemplate.Open("YourFilePath.docx");

    // yourData is a a DataTable in this case, 
    // but SetDataSource has many overloads
    wordTemplate.SetDataSource(yourData);

    wordTemplate.Process();

    wordTemplate.Save("OutputFilePath.docx");
}

    

Sign up to request clarification or add additional context in comments.

Comments

0

Microsoft provides a development platform for handling Word (.docx), Excel (.xlsx) and PowerPoint (.pptx) files without installing the softwares. The feature is avaliable like a SDK.

Look this: http://msdn.microsoft.com/en-us/office/bb265236.aspx

If you wanna more help, please try something and post.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.