Reputation: 1083
Now i am using the MSWord documents as inputs to the Visual Studio 2005 applications.
And i am beginner to these namespace to develop a new apllications so i need to learn something about this namespace.......
Can anyone know where to learn about Microsoft.Office.Interop
namespace methods
And the VBA methods for that Word object with small sample code.
Can anyone know any websites, books (for Visual Studio 2005) plz help me..
Upvotes: 0
Views: 169
Reputation: 2388
When using .net, developers will usually prefer to use a .Net library to open, access and manipulate Office documents. This has the benefit that you can handle everything in your own .Net process, you can run the code on computers that do not have Office installed and you don't have to worry about badly managed connections to the Office instances.
For Word documents, http://docx.codeplex.com/ is an excellent library and the website has links to plenty of examples, such as the following:
using System;
using Novacode;
using System.Drawing;
namespace DocXHelloWorld
{
class Program
{
static void Main(string[] args)
{
using (DocX document = DocX.Create("Test.docx"))
{
// Add a new Paragraph to the document.
Paragraph p = document.InsertParagraph();
// Append some text.
p.Append("Hello World").Font(new FontFamily("Arial Black"));
// Save the document.
document.Save();
}
}
}
The page where this sample comes from compares the code for doing the same thing with Office Interop, Microsoft's OOXML SDK and the DocX library, so visit it for examples of the other options: http://cathalscorner.blogspot.com/2010/06/cathal-why-did-you-create-docx.html
Note: because you did not specify it, I presume you are using the latest document formats (.docx)
Upvotes: 2