Creating and editing a dictionary document using a program

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

I know that we can run other programs from the command line, but what I want to do is create the document programmatically without using the Microsoft Word user interface.

Can this be done?

+4
source share
6 answers

in C # Import COM Link Microsoft Word Object Library

using Microsoft.Office.Interop.Word; 

Then you can 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 do not know how to do this in JAVA, but I am sure that this is possible.

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

+3
source

I don't know about C #, but Java has an Apache POI project that supports reading / writing text documents.

http://poi.apache.org/hwpf/index.html

+2
source

You can use the Open XML SDK 2.0 to programmatically create a Word document.

+1
source

It depends on the version of the Word document that you are targeting. It can be Word 95 (classic word), Open XML, RTF, etc.

RTF may be the easiest to handle, Open XML is normalized, so the documents are accessible, the .doc format has the opposite construction, therefore it is known, and I think that in fact there is a Java library for processing it.

The exact answer depends on your specific needs ...

+1
source

You can try Aspose.Words for .NET or Aspose.Words for Java . These components can work with the .NET or Java programming languages, respectively, and allow you to create or edit Word documents. In addition, you do not need to install Microsoft Office on the computer on which your code is running.

Disclosure: I work as an evangelist developer at Aspose.

+1
source

Although I do not understand the real purpose of this, the answer is YES.

Not just a word, any Microsoft document. Usually, every little functionality in an office is produced as a component of COM / COM +. You will be able to access most of them from other programming languages. You will access them as a COM API.

Microsoft's documentation pretty much explains which APIs are available and how to program them.

0
source

All Articles