![]() ![]() So instead of supplying the same input parameter ten times, we can make all the input parameters point to the location same single variable in them memory. In automation it makes sense as to why most of the input parameters are of reference types it might be because of the fact that most of the methods a multitude of input parameters (many have more than 10 input parameters) and their value is going to be either true, false or missing in most of the cases. Most of the methods have input parameters which are of reference type, and the values are mostly true, false or missing (null). We can otherwise build a word document from scratch.We can either have a base template (.dot) file and open the base template file and work on it.This triggers the following operation in the Word Application OWordDoc = (ref oMissing, ref oMissing, ref oMissing, ref oMissing) ADDING A NEW DOCUMENT TO THE APPLICATION Word.Document oWordDoc = new Word.Document() Word.Application oWord = new Word.Application() If we need to add a new document file, first we have to create an instance of the Word.Document object and then add it to the Word.Application. Creating a new instance of Word.Application can be visualized as below. This is like the base class which is needed to create a new document. This represents in Word Application without any new document loaded in it. The Word.Application and Word.Document are used to Open Word and add a new Document to it. The same steps needs to be done programmatically. (Opening Word Application creates a new document by default, but in Automation, wee need to manually add a document) Let's consider that we want to create a document using the Word Application, we might end up doing the following steps, Note: This DLL would be present only if Microsoft Office is installed on the Machine.Īlso include "using Microsoft.Office " in the Namespaces used.Īll the methods used Word automation is derived either from Word.Application or Word.Document class. This DLL has all the methods which we do to perform the automation. This can be done by right clicking the Reference Folder in the Solution explorer of the project and select Add Reference.īrowse Through the available COM objects and Select Microsoft Office 11.0 Object Library & Microsoft Word 11.0 Object Library. Starting off, the first step is to include the Word DLL's to the Solution. Tasks like Inserting Table of Contents, Linking documents, Mail Merge, Inserting Documents, Embedding documents, inserting pictures, watermark. Almost all of the tasks which we perform on word 2003 can be done programmatically using C# or VB. Word automation almost completely involves working with objects and reference types. ![]() Working on Word is considered to be straightforward, but doing the same programmatically gets a little intricate. Word Automation through C# is all about programmatically generating the Word Document using C# code. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |