Aspose.Words  for Java

Java API to Process Word Files

Develop applications with the ability to create, process, render and convert Word documents to multiple formats in Java.

  Download Free Trial
  
 

Aspose.Words for Java is a feature rich document processing API to create, modify, convert, render and print files in all formats supported by Microsoft Word and more. It does not depend on Microsoft Word or other third-party applications. However Aspose.Words for Java provides features that Word supports – compare documents, find and replace text, split a document into parts, mail merge fields, render pages, format all document elements and so on. You can see the full list of Aspose.Words features in our documentation.

Aspose.Words API supports all popular loading and saving formats. You can save or convert Word documents to fixed-layout formats – PDF or XML, as well as convert your Word files to popular image or multimedia formats – JPEG, SVG, GIF and others. Check out the full list of supported formats.

Advanced Java Words API Features

You can try some of the popular Aspose.Words features on the online application pages:

You can try all Aspose.Words online applications.

Also check out tehh documentation for the most popular features in Aspose.Words:

Please note that the list is not complete and you can find more features and descriptions in the documentation.

Convert a Document in Java

The ability to quickly, reliably and efficiently save a file into different formats with a high degree of precision is the reason most of our customers choose Aspose.Words.

Java API allows you to convert a file from one supported format to another with just two lines of code. It is so simple!

Convert DOC to DOCX – Java

// Load DOC file to be converted
Document wpd = new Document(dir + "template.doc");

// Convert DOC to DOCX
wpd.save(dir + "output.docx", SaveFormat.DOCX);

Convert HTML to DOCX – Java

// Load HTML file to be converted
Document wpd = new Document(dir + "template.html");

// Convert HTML to DOCX
wpd.save(dir + "output.docx", SaveFormat.DOCX);

Convert RTF to PDF – Java

// Load RTF file to be converted
Document wpd = new Document(dir + "template.rtf");

// Convert RTF to PDF
wpd.save(dir + "output.pdf", SaveFormat.PDF);

See more details on the Conversion page.

Render, View or Print Files using Java

Aspose.Words for Java has its own rendering engine specifically designed to render and print documents with highest fidelity.

On the documentation pages you can find out how to:

Reporting and Mail Merge

Aspose.Words for Java is a full featured reporting solution. You can design reports in Microsoft Word and then allow the API to populate files with data from a variety of data sources while keeping the mail merge settings preserved.

Aspose.Words for Java allows you to use standard Microsoft Word mail merge fields in reports. Additionally, you can use library extended syntax for mail merge fields to perform more complex tasks during the merging operations such as inserting images or repeatable regions.

Programming with Documents Using Document Object Model (DOM)

Aspose.Words for Java helps developers to create, build, modify, parse and examine loaded files using our intuitive Document Object Model (DOM) that consists of over 100 classes. This object model allows developers to programmatically manipulate various elements such as Sections, Headers, Footers, Paragraphs, Lists, Tables, Text, Fields, Hyperlinks, Bookmarks, Images, Smart tags, Shapes, Custom XML and more.

Furthermore, all drawing objects, including shapes, text boxes, images, OLE objects and controls are supported through this document object model, allowing you to perform many tasks such as inserting watermarks on pages or extracting images from a pre-existing file.

Aspose.Words for Java provides useful utility features, for example, join or split files, find and replace text, protect or unprotect files, modify properties and insert HTML fragments into documents. All of these features are available via easy-to-use APIs to help developers perform complex operations without worrying about the file format specifications.

Join two documents – Java

// Load source & destination files
Document srcDoc = new Document(dir + "source.docx");
Document dstDoc = new Document(dir + "destination.docx");

// Set the appended file to start from a new page
srcDoc.getFirstSection().getPageSetup().setSectionStart(SectionStart.NEW_PAGE);

// Append the source file using its original styles
dstDoc.appendDocument(srcDoc, ImportFormatMode.KEEP_SOURCE_FORMATTING);

// Save final result
dstDoc.save(dir + "output.docx");

No Need for Microsoft Office Automation

You can work with documents programmatically without installing any other third-party application. This is possible because the library is built using managed code. Therefore, you do not need to install Microsoft Office or Microsoft Word on your computer to work with Word formats. It is a perfect alternative to Microsoft Office Automation in terms of supported features, security, stability, scalability, speed, and price.

What People Are Saying

Don't just take our word for it. See what users have to say about Aspose.Words APIs.

 
 
View Case Studies
  

Support and Learning Resources