---
Product: Aspose.Words
Platform: java
Page Type: index
Canonical URL: https://products.aspose.org/words/java/
---

# Aspose.Words FOSS for Java

Create, edit and convert Word documents from Java, with no Microsoft Word installed. Reads and writes DOCX, Markdown and plain text. MIT-licensed.

Aspose.Words FOSS for Java is a free, MIT-licensed Java library for creating, editing and converting Word documents. Reads and writes DOCX, Markdown and text.

## Open-Source Java Library for Word Documents

Aspose.Words FOSS for Java is an MIT-licensed Java library for creating, editing and converting Word documents. `Document` holds a whole document and `DocumentBuilder` writes content into it. DOCX, DOCM, DOTX, DOTM, four Flat OPC variants, Markdown and plain text can be loaded and saved, and no copy of Microsoft Word is needed.

The library builds documents from code, including headings, paragraphs and tables. It replaces text with `Range.replace`, appends one document to another with `appendDocument`, and accepts tracked changes with `acceptAllRevisions`. The API reference lists 634 public types.

This is the open-source edition. It uses the package name `com.aspose.words` of the commercial Aspose.Words for Java but reads and writes a smaller set of formats: saving in any other format, such as PDF, XPS, HTML, EPUB, RTF, DOC, ODT, WordML or an image format, is rejected, and so is loading a DOC, DOT, RTF, WordML, HTML, MHTML, ODT, OTT or PDF file. It installs with a single Maven dependency (`org.aspose:aspose-words-foss:26.4.0`, listed on [Maven Central](https://central.sonatype.com/artifact/org.aspose/aspose-words-foss)) and needs Java 8 or later.

For the enterprise product family, see [Aspose.Words — Enterprise Product Family](https://products.aspose.com/words/).

## Documents and Text

- **Create documents:** `Document` creates a blank document, or opens an existing file when you pass a file name.
- **Write content:** `DocumentBuilder` keeps a cursor in the document and `writeln` inserts a line of text.
- **Headings and styles:** set `StyleIdentifier.HEADING_1` on the paragraph format before writing a heading.
- **Read text:** `getText` returns the text of a document.

## Typical Tasks

- Generate a report with a heading and paragraphs from code.
- Open a DOCX and read its text.
- Save a document under a new file name.

## Tables, Find and Replace

- **Tables:** `startTable`, `insertCell`, `endRow` and `endTable` on `DocumentBuilder` build a table cell by cell.
- **Replace text:** `Range.replace` replaces all occurrences of a string and returns the number of replacements.
- **Placeholders:** open a template, replace a marker such as {{CLIENT_NAME}} and save the filled copy.

## Typical Tasks

- Fill a contract or letter template from application data.
- Add a table to a generated report.

## Conversion Between Formats

- **Read and write:** DOCX, DOCM, DOTX, DOTM, Flat OPC, Markdown and plain text are loaded and saved in both directions.
- **Convert by file name:** open a file with the `Document` constructor and save it with the file extension of the target format.
- **Rejected formats:** saving in any other format (PDF, XPS, HTML, MHTML, EPUB, RTF, DOC, ODT, WordML, XLSX, images and more) and loading DOC, DOT, RTF, WordML, HTML, MHTML, ODT, OTT or PDF throw an `UnsupportedOperationException` whose message starts with FOSS.

## Typical Tasks

- Turn a Markdown file into a DOCX.
- Export a DOCX as Markdown or plain text.

## Tracked Changes and Merging

- **Accept changes:** `acceptAllRevisions` accepts every tracked change in a document.
- **Merge documents:** `appendDocument` appends one document to another, and `ImportFormatMode` chooses how formatting is handled.

## Typical Tasks

- Finalize a reviewed document and save the clean version.
- Combine a main document and an appendix into one file.

## Create a Document and Convert a File to Markdown

Create a document with a heading and a paragraph, save it as DOCX, then open an existing document and save it as Markdown. The last two lines open Report.docx, which must already exist in the working directory; without it the constructor throws a `FileNotFoundException`.

```xml
<dependency>
  <groupId>org.aspose</groupId>
  <artifactId>aspose-words-foss</artifactId>
  <version>26.4.0</version>
</dependency>
```

```java
import com.aspose.words.*;
// Create a document from scratch.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.HEADING_1);
builder.writeln("Hello from Aspose.Words FOSS!");

builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.BODY_TEXT);
builder.writeln("This document was created entirely in code, no Word installed.");

doc.save("Hello.docx");

// Convert an existing document to Markdown.
Document report = new Document("Report.docx");
report.save("Report.md");
```

## Convert Markdown to DOCX

Pass the Markdown file name to the `Document` constructor and save the document with a .docx file name.

```java
import com.aspose.words.*;
Document doc = new Document("notes.md");
doc.save("notes.docx");
```

## Accept Tracked Changes

Open a reviewed document, accept all tracked changes and save the final version.

```java
import com.aspose.words.*;
Document doc = new Document("reviewed.docx");
doc.acceptAllRevisions();
doc.save("final.docx");
```

## Merge Two Documents

Append a second document to the first and keep the source formatting.

```java
import com.aspose.words.*;
Document main = new Document("main.docx");
Document appendix = new Document("appendix.docx");
main.appendDocument(appendix, ImportFormatMode.KEEP_SOURCE_FORMATTING);
main.save("combined.docx");
```

## Frequently Asked Questions

### What is the licensing model?

Aspose.Words FOSS for Java is open-source software released under the MIT license.

### Is this the same as the commercial Aspose.Words for Java?

No. It is a reduced edition that uses the same package name, com.aspose.words, but reads and writes a smaller set of formats. The commercial product is separate and has its own license.

### How do I install it?

Add `org.aspose:aspose-words-foss:26.4.0` to your Maven build. The library needs Java 8 or later and runs on Java 8, 17 and 21. Microsoft Word is not needed.

### Which formats can I read and write?

DOCX, DOCM, DOTX, DOTM, four Flat OPC variants, Markdown and plain text were loaded and saved in both directions.

### Which formats are rejected?

Saving as DOC, DOT, RTF, WordML, ODT, OTT, PDF, XPS, OpenXPS, PS, PCL, HTML, fixed-page HTML, MHTML, EPUB, AZW3, MOBI, XAML (fixed and flow), XLSX, Docling, SVG, EMF, EPS, TIFF, PNG, BMP, JPEG, GIF or WebP throws an UnsupportedOperationException whose message starts with FOSS. Loading a DOC, DOT, RTF, WordML, HTML, MHTML, ODT, OTT or PDF file does the same, and this edition has no reader for EPUB, MOBI, AZW3, CHM or Microsoft Works files (an EPUB file throws an exception, and a MOBI, AZW3 or CHM file under its own file extension is not recognised and opens as unreadable plain text).

### Can I create digital signatures?

No. DigitalSignatureUtil.sign throws an UnsupportedOperationException whose message starts with FOSS. The Bouncy Castle FIPS classes bundled in the jar are a modified rebuild and not the certified FIPS 140 module; SecuritySettings.startFipsMode() turns on Bouncy Castle's approved-only mode for the calling thread only.

## Support and Learning Resources

- [Documentation](https://docs.aspose.org/words/java/)
- [API References](https://reference.aspose.org/words/java/)
- [Free Support](https://forum.aspose.org/)
- [Contribution](https://contribution.aspose.org/)
- [Blog](https://blog.aspose.org/)
- [New Releases](https://releases.aspose.org/)