65.9K
CodeProject is changing. Read more.
Home

Append Word documents using interop services

starIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIconemptyStarIcon

1.17/5 (9 votes)

May 12, 2005

viewsIcon

39540

downloadIcon

719

An article on Word append using interop.

Introduction

This source code is helpful to append set of documents and generate a single document.

Background (optional)

I have assigned a project in my company to generate a proposal that contains different sections. Each section will be presented in a separate word document. I have implemented this project using word interop services in .NET.

 

Using the code

The implementation is very simple. A line code has been used to append a set of documents. The code is,

oWord.Selection.InsertFile(strFile2,ref oObject,ref oObject,ref oObject,ref oObject)

To run this application you should have below references,

Microsoft Office 9.0 Object Library

Microsoft Word 9.0 Object Library

 

GenerateDocument Method

This method is designed to generate the appended document. In this, system gets the file names from the xml file And append the files one by one and present the final file. Page break has been implemented between each file that is inserted. The example project has been given in zip format.