Aspose.Words  Cloud SDK for Java

Work with Word Documents in Java

Open, create, edit, merge, split, compare and convert a Word document in Java

Get Started

Open, create, edit, merge, split, compare and convert a Word document in Java. It's easy for Java developers to manipulate Microsoft Word documents. Simply integrate our Cloud API into your Java applications to get full-featured Word API to handle documents. It supports all popular file formats such as DOCX, DOC, RTF, HTML, ODT, XPS, EPUB, etc.

File handling is an important part of any application. Java has several methods for creating, reading, updating and deleting files. Java API offers methods which allow you to:

  • Convert DOCX, DOC, PDF, JPG, etc.
  • Perform the basic CRUD operations of creating, retrieving, updating and deleting documents.
  • Perform various Word operations.
  • Insert page numbers.
  • Append, convert and split documents.

Note: Java APIs libraries are hosted on Aspose repository.

Advanced Word Document Processing Features

Merge multiple Word documents

Split all or specific pages of a Word document

Convert Word documents to different formats

Manipulate document properties

Execute simple to complex mail merge

Execute mail merge template

Insert scaled images on merge fields

Insert a page number field into Word documents

Insert or edit watermark in Word documents

Find or replace text in Word documents

Password protect Word documents or update document protection

Load & convert PDF documents to Word formats including DOC & DOCX

Key features in Java

You can use API to perform different operations on Word documents such as inserting a table, adding paragraphs, extracting text, inserting an image, inserting a watermark image, getting hyperlinks and adding a header or a footer.
You can perform conversion operations for different file formats in Java such as:

  • Convert PDF to Word.
  • Convert Word to PDF.
  • Convert Word to TXT.
  • Convert Word to EPUB.
  • Convert DOCX to image.

Work with Word Tables via Java

You can use a table to structure content, place text or images in one cell and align it accordingly. Furthermore, tables can be nested inside other tables up to any depth with Java API.

Working with tables includes many tasks such as:

  • Getting a list of tables that are contained in a Word document.
  • Inserting, updating, deleting and getting a table from a document.
  • Adding a table to a document.
  • Getting and updating table properties.
  • Getting, adding and deleting a table.
  • Getting, adding and deleting a table cell.
  • Extracting data from a table.

Working with Word Math Objects

API allows you to get all Word Math objects that are defined in a document.
It includes many tasks such as getting and removing Objects from a Word document.

Working with Headers and Footers

API supports page headers and page footers.
This includes many tasks such as:

  • Accessing the header for a section.
  • Removing a header.
  • Adding a header.
  • Getting all headers and footers in a Word document.

Report Generation and Mail Merge

Our API report generation and mail merge provide you with several tasks such as:

  • Using Word merge fields or Mustache.
  • Preparing DOCX templates to populate or other supported file formats.
  • Populating templates with data from JSON, XML.
  • Inserting HTML and images during mail merge.

Working with Text in Word via Java

API allows you to find and replace text in DOCX and other documents in Java.
It has string searching and string matching algorithms to find all appearances of a character pattern, to find a place where one or many patterns are found within a larger string or text.
In other words, it finds substring matches inside a given string and finding dictionary strings that match the pattern defined by a regular expression.
You can replace all occurrences of a specified string with another string in Java.

Java API Installation

You can use Java API directly in your Maven Projects with simple configuration steps in pom.xml:

  1. Add Aspose Maven repository in repositories section.
  2. Define Java API dependency in dependencies section.

How to open and edit a DOCX document in Java

  1. Add Java dependency.
  2. Go to the Aspose Cloud Dashboard.
  3. Create a new Account to access all applications and services or Sign In to your existing account.
  4. Click on Applications in the left menu to get Client Id and Client Secret.
  5. Upload a DOCX file to the Cloud Storage or use directly in the request body.
  6. Check Developer Guide to edit a DOCX file in Java.

Support and Learning Resources