An open API service indexing awesome lists of open source software.

https://github.com/syncfusionexamples/java-word-find-and-replace-examples

Find and replace text in a Word document in Java without Microsoft Word or interop dependencies.
https://github.com/syncfusionexamples/java-word-find-and-replace-examples

find-and-replace java word-library

Last synced: 4 months ago
JSON representation

Find and replace text in a Word document in Java without Microsoft Word or interop dependencies.

Awesome Lists containing this project

README

          

# Java Word Find and Replace Examples

This repository contains examples that illustrates how to find and replace text in Word documents programmatically in Java using [Syncfusion’s Java Word library](https://www.syncfusion.com/document-processing/word-framework/java/word-library?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) (Essential® DocIO) without Microsoft Word or Office interop dependencies.

## Find and replace text in Word documents using Java

The Syncfusion® Java Word library (Essential® DocIO) provides comprehensive APIs to find and replace text in a Word document with any desired text, image, hyperlink, paragraph, table, and part of a document or an entire document. It provides options to find text by matching case and whole words. You can find each occurrence one by one or all the occurrences of a text in the document. It saves your efforts and time by helping you to automate find and replace a pattern of text in a Word document using Regex. It allows you to save the resultant document as Word document (DOCX, WordML), HTML, RTF.

## Jar files

You can download the jars from the Syncfusion® [maven repository](https://jars.syncfusion.com/?_ga=2.177721445.1332356717.1617771042-23317178.1569844681) to use our artifacts in your projects. It helps you to use the Syncfusion® Java packages without installing Essential Studio® or platform installation to development with Syncfusion® controls.

## Key Features

- [Find and highlight text in Java](findandhighlighttext/) - Find text from a Word document and format or highlight it.

- [Find and replace text in Java](findandreplacetext/) - Find text from a Word document and replace it with another text.

- [Replace text with image in Java](replacetextwithimage/) - Find a placeholder text from a Word document and replace it with any desired image.

- [Replace text with merge field in Java](replacetextwithmergefield/) - Find a pattern of text from a Word document and replace it with merge fields.

- [Replace text with table in Java](replacetextwithtable/) - Find a placeholder text from a Word document and replace it with a table.

- [Replace text with document in Java](replacetextwithdocument/) - Find text from a Word document and replace it with another Word document.

- [Find and replace several paragraphs in Java](findandreplaceseveralparagraphs/) - Find text that extends to several paragraphs in a Word document and replace it with another Word document.

## Screenshots

**Find and highlight text**


Find text from a Word document and format or highlight it in Java

**Find and replace text**


Find a misspelt word from a Word document and replace it with desired word in Java

**Replace text with table**


Find text from a Word document and replace it with a table in Java

## Syncfusion® Java Word Library

The Syncfusion® DocIO is a [Java Word library](https://www.syncfusion.com/document-processing/word-framework/java/word-library?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) allows you to add advanced Word document processing and does not require Microsoft Word application to be installed in the machine. It is a non-UI component that provides a full-fledged document instance model similar to the Microsoft Office COM libraries to iterate with the document elements explicitly and perform necessary manipulation.

Take a moment to peruse the [documentation](https://help.syncfusion.com/java-file-formats/word-library/getting-started?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), where you can find basic Word document processing options along with the features like [mail merge](https://help.syncfusion.com/java-file-formats/word-library/working-with-mail-merge?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [merge](https://help.syncfusion.com/java-file-formats/word-library/working-with-word-document?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples#merging-word-documents), [find and replace](https://help.syncfusion.com/java-file-formats/word-library/working-with-find-and-replace?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) text in the Word document, [protect](https://help.syncfusion.com/java-file-formats/word-library/working-with-security?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) the Word documents and most importantly, [RTF](https://help.syncfusion.com/java-file-formats/word-library/rtf?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [Text](https://help.syncfusion.com/java-file-formats/word-library/text?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), and [HTML](https://help.syncfusion.com/java-file-formats/word-library/html?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) conversions with code examples.

## Compatible Microsoft Word Versions

* Microsoft Word 97-2003
* Microsoft Word 2007
* Microsoft Word 2010
* Microsoft Word 2013
* Microsoft Word 2016
* Microsoft Word 2019
* Microsoft 365

## Supported File Formats

* Creates, reads, and edits popular text file formats like [DOCX](https://help.syncfusion.com/java-file-formats/word-library/word-file-formats?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples#word-open-xml-formats-2007--later), [DOTX](https://help.syncfusion.com/java-file-formats/word-library/word-file-formats?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples#templates), DOTM, [DOCM](https://help.syncfusion.com/java-file-formats/word-library/word-file-formats?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples#macros), [WordML](), [RTF](https://help.syncfusion.com/java-file-formats/word-library/rtf?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [Text](https://help.syncfusion.com/java-file-formats/word-library/text?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [HTML](https://help.syncfusion.com/java-file-formats/word-library/html?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).
* Converts Word documents also to [RTF](https://help.syncfusion.com/java-file-formats/word-library/rtf?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [Text](https://help.syncfusion.com/java-file-formats/word-library/text?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), and [HTML](https://help.syncfusion.com/java-file-formats/word-library/html?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).

## Resources

- **Product page:** [Syncfusion® Java Word Framework](https://www.syncfusion.com/document-processing/word-framework/java?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples)
- **Documentation:** [Find and Replace using Syncfusion® Java Word library](https://help.syncfusion.com/java-file-formats/word-library/working-with-find-and-replace?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples)

## Support and feedback

For any other queries, reach our [Syncfusion® support team](https://support.syncfusion.com/?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) or post the queries through the [community forums](https://www.syncfusion.com/forums?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).

Request new feature through [Syncfusion® feedback portal](https://www.syncfusion.com/feedback?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).

## License

This is a commercial product and requires a paid license for possession or use. Syncfusion's licensed software, including this component, is subject to the terms and conditions of [Syncfusion's EULA](https://www.syncfusion.com/license/studio/22.2.5/syncfusion_essential_studio_eula.pdf?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples). You can purchase a licnense [here](https://www.syncfusion.com/sales/products?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) or start a free 30-day trial [here](https://www.syncfusion.com/account/manage-trials/start-trials?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).