Creating and Editing word document by using a program

I was wondering if it is possible to create a Microsoft Word Document programmatically (through Java, C#, or another language). Is it also possible to do things like adding text or changing the font?

I know that we can start other programs from the command prompt, but what I want to do is to create the document programmatically without using the UI of Microsoft Word.

Can this be done?

Answer

in C# Import the COM reference Microsoft Word Object Library

using Microsoft.Office.Interop.Word; 

You can then set variables for paragraphs, tables, etc

        Dim oWord As Word.Application
        Dim oDoc As Word.Document
        Dim oTable As Word.Table
        Dim oPara1 As Word.Paragraph, oPara2 As Word.Paragraph

C# tutorial

I am unfamiliar how to do it in JAVA but I am sure it is possible

It can also be done in VB.net (naturally!) Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *