Showing posts with label Word. Show all posts
Showing posts with label Word. Show all posts

Monday, May 26, 2008

Sample Code Word 11.0 Object Library

Just add the reference of Microsoft Word 11.0 Object library and play with the following code by putting in your method:


Microsoft.Office.Interop.Word.Document doc = new Microsoft.Office.Interop.Word.Document();

ApplicationClass myWordApp = new ApplicationClass(); // our application


object nothing = System.Reflection.Missing.Value; // our 'void' value

object filename = "C:/TestDoc/TestDot.dot"; // our word template

object destination = "C:/TestDoc/MyNewDocument.doc"; // our target filename

object notTrue = false; // our boolean false


myWordApp.Visible = false;

doc = this.myWordApp.Documents.Add(ref filename, ref nothing, ref nothing, ref nothing);


doc.WebPagePreview();


doc.SaveAs(

ref destination,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing,

ref nothing);

Office Programming

Microsoft Office document creation and update is one of the hot topic in any project. Because organizations require them very often. So it is the duty of every software engineer to have a expetise on those technologies which are related to this requirement.

I recommend reading about these.

Visual Studio Tools for Office.
Microsoft Word Object Library
Microsoft Excel Object Library

Just search these on the google and read the wonderful information on the internet about these.