Spire.Doc for Java

Java Word Library – Create Read Modify Print Convert Word Documents in Java

  • Overview
  • Features
  • Support
  • What's New
  • Live Demo

Professional Java Library
to Process Word documents

Over 1,000,000 Developers Are Already Using Our Libraries
To Create Their Amazing Applications.

Spire.Doc for Java is a professional Word API that empowers Java applications to create, convert, manipulate and print Word documents without dependency on Microsoft Word.


By using this multifunctional library, developers are able to process copious tasks effortlessly, such as inserting images, shapes, lists, hyperlink, pages, digital signature, WordArt, variables, bookmark, watermark, barcodes, page breaks, section breaks, math equations, and setting header and footer, creating table, setting background image, setting fonts, adding footnote/endnote etc.


In addition, Spire.Doc for Java supports file format conversions from Word to PDF, XPS, XML, RTF, TXT, Excel, image (JPG, PNG and SVG), EPUB, HTML, PostScript, ODT, PCL (Printer Command Language), WordML and many more. Furthermore, it supports to convert RTF to HTML/image/PDF, convert HTML to PDF/images, convert XML/ODT to PDF, convert Markdown to Word/PDF in high quality.

  • Convert

  • Compare

  • Extract

  • eSign

  • Watermark

  • Replace

  • Mail Merge

  • Highlight

  • Header

  • Form

Convert Word to PDF

PDF files are preferred over Word documents because they are safe, simple to open, and easy to manage on any device. PDF is the most popular file format that users would convert Word to.

Compare Documents

If you receive two nearly-identical Word documents, the ideal way to determine whether there are any differences between them is to compare the two documents.

Extract Text and Images

When you just need to get the information in a Word document regardless of its format and structure, you can simply extract the text and images from the document.

Digitally Sign Documents

A digital signature provides assurances about the validity and authenticity of your Word documents. Once a Word document is digitally signed, any changes to the document will invalidate the signature.

Add a Watermark

A watermark is used to declare confidentiality, copyright, or other attributes of the document, or as a decoration to make the document more attractive. You can add either text or image watermarks to Word documents.

Replace Text

The ability to replace existing text (or placeholders) in a Word document makes it possible for programmers to quickly generate Word reports or documents based on a template.

Mail Merge

Mail Merge is a handy feature that allows you to quickly produce multiple documents, such as letters or emails, using information stored in a list, spreadsheet or database.

Find and Highlight

If you want to emphasize some words, you can find and highlight them in a bright color so that the readers could catch them easily.

Headers and Footers

Headers and footers are useful for including information that you want to appear on every page of a document, such as company logo or page number.

Create a Form

Form fields make it easier to collect information. Users can enter information by choosing an item from a drop-down list, inserting text in a combo box, or checking a check box.

JAVA

Standalone Java Component

100% independent Java Word class library
Doesn't require Microsoft Office installed on system.

VERSION

  • Word 97-03
  • Word 2007
  • Word 2010
  • Word 2013
  • Word 2016
  • Word 2019

OPERATION

Powerful Toolset, Multichannel Support

  • Mail Merge, Create Field, Fill Field, Update Field

  • Protect, Encrypt, Decrypt

  • Find Replace Highlight

  • Insert, Edit, remove bookmark

  • Image and Shape

  • Merge and Split Word document

  • Header and Footer

  • Insert, Reply, remove comment

  • Create & Update Table

  • Print Word Document

  • Create, Modify, Remove hyperlink

CONVERSION

Convert File Documents with High Quality

  • PDF

  • XPS

  • EPUB

  • SVG

  • PCL

  • Image

Doc/Docx

  • ODT

  • XML

  • HTML

  • RTF

  • TXT

  • PNG

  • BMP

  • JPEG

MAIN FUNCTION

Only Spire.Doc for Java, No Microsoft Office

Spire.Doc for Java is a totally independent Word component, Microsoft Office is not required in order to use Spire.Doc for Java.

High Quality File Conversion

Spire.Doc for Java allows converting popular file formats like HTML, RTF, ODT, TXT, WordML, WordXML to Word and exporting Word to commonly used file formats such as PDF, XPS, XML, RTF, TXT, image (JPG, PNG and SVG), EPUB, HTML, ODT, PCL (Printer Command Language), WordML in high quality. Moreover, conversion between Doc and Docx is supported as well.

Support a Rich Set of Word Elements

Spire.Doc for Java supports a rich set of Word elements, including section, header, footer, footnote, endnote, paragraph, list, table, text, font, TOC, form field, mail merge, hyperlink, bookmark, watermark, barcodes, image, style, shape, textbox, OLE, WordArt, background settings, digital signature, document settings, protection and many more.

Easy Integration

Spire.Doc for Java can be easily integrated into Java applications.

Commercial Edition $999

Compared with Free Spire.Doc for Java, the commercial edition of Spire.Doc for Java has no limitation on the number of paragraphs and tables and is more comprehensive in processing Word files.


Free Edition $0

Free Spire.Doc for Java is limited to 500 paragraphs and 25 tables. This limitation is enforced during reading or writing files. When converting Word documents to PDF and XPS files, you can only get the first 3 pages of PDF file.

GET STARTED

Free Trials for All Progress Solutions

Here is a brief summary of Spire.Doc for Java features.

Generating, Writing, Editing and Saving

Spire.Doc for Java enables quick generating, saving, writing and editing Word documents.
  • Generate and save Word documents (Word 97-2003, Word 2007, Word 2010, Word 2013, Word 2016 and Word 2019).
  • Load and save document with macros, including .doc (Word 97-2003) document with macros and .docm(Word 2007, Word 2010, Word 2013, Word 2016 and Word 2019) document.
  • Write and edit text and paragraphs.

Converting

Spire.Doc for Java enables converting Word documents to most common and popular formats.
  • Bi-directional conversion Doc-Docx: Convert .doc document (Word 97-2003) to .docx document (Word 2007, Word 2010, Word 2013, Word 2016 and Word 2019) and vice versa.
  • Bi-directional conversion Doc(x)-RTF: Convert .doc(x) document to RTF (Rich Text Format) and vice versa.
  • Bi-directional conversion Doc(x)-TXT: Convert .doc(x) document to TXT (Plain Text) and enable to load TXT file and save as .doc(x) document.
  • Bi-directional conversion Doc(x)-HTML: Convert .doc(x) document to HTML file and enable to load HTML file and save as .doc(x) document.
  • Bi-directional conversion Doc(x)-Dot: Convert .doc(x) document to Dot and vice versa.
  • Bi-directional conversion Doc(x)-XML: Convert .doc(x) document to XML and enable to load XML file and save as .doc(x) document.
  • Unidirectional Conversion Doc(x)-XPS: Convert .doc(x) document to XPS document.
  • Unidirectional Conversion: Doc(x)-EPUB: Convert .doc(x) document to EPUB (Digital Publishing).
  • Unidirectional Conversion: Doc(x)-PDF: Convert .doc(x) document to PDF in high quality, including contents and formats.

Inserting, Editing and Removing Objects

Spire.Doc for Java enables to inserting, editing and removing external objects in Word.

Formatting

Spire.Doc for Java enables formatting contents in documents, including character, paragraphs, pages and whole document.
  • Format all characters in document, including fonts, sizes, colors, effects etc.
  • Format paragraphs, including built-in styles, indents, spacing, bullets, alignment, headings and number list style etc.
  • Format Word tables, including cell fonts and colors, cell background color, cell alignment, cell borders and column width/row height setting.
  • Format Word page, including page breaks, border, margins, paper size and orientation.
  • View document with different document view types, zoom percent and zoom types.

Mail Merge

Spire.Doc for Java enables executing mail merge function to create records, orders and reports.
  • Perform simple mail merge fields (name and value) to create single item.
  • Execute mail merge to create a group of data records with connecting customized data source.

Frequently asked question for Spire.Doc for Java of technical and function issues.

We guarantee one business day Forum questions Reply.

We guarantee one business day E-mail response.

Free Customized service for OEM Users.

Skype name: iceblue.support

Apply for a Free Trial License File.

To help you get started quickly, we offer free customized demos to our customers. Please contact [email protected] for the free demo. Make sure the demo you want meets the below requirements.
  • It relates to our components stored on E-iceblue online store.
  • It costs less than 2 hours for us to complete it. If it costs more than 2 hours, please contact our [email protected]

If you have tried out Spire.Doc for Java and found it useful, please consider sharing your experience with others. By sharing your testimonial with us, you will not only help others to make the right decision but will also to earn rewards from us. Please send your testimonials to [email protected].

This is the list of changelogs of Spire.Doc for Java New release and hotfix. You can get the detail information of each version's new features and bug solutions.

Download Spire.Doc for Java to start a free trial:

Version: 12.11.9

Category ID Description
Bug SPIREDOC-10245 Fixes the issue that the layout of some content was incorrect when converting Word to PDF.
Bug SPIREDOC-10538 Fixes the issue that the bookmarks cannot be redirected when converting Word to PDF.
Bug SPIREDOC-10610 Fixes the issue that the program threw an "IllegalStateException" error when converting Word to PDF.
Bug SPIREDOC-10872 Optimizes the time-consuming issue of adding images in Word.
Bug SPIREDOC-10909
SPIREDOC-10940
Fixes the issue that the program threw a 'NullPointerException' error while comparing documents.
Bug SPIREDOC-10923 Fixes the issue that the program threw a 'ClassCastException' error while loading a document.
Bug SPIREDOC-10926 Fixes the issue that the program threw an "IllegalArgumentException" error while comparing documents.
Bug SPIREDOC-10929 Fixes the issue that the permission protection was lost after multiple operations on documents with restricted editing.
Bug SPIREDOC-10936 Fixes the issue that the program threw an "Can't create formfield with 'Check1' name" error when converting RTF to PDF.
Bug SPIREDOC-10960 Fixes the issue that the program threw the error "Index is less than 0 or more than or equal to the list count" when using updateTableOfContents() method.
Bug SPIREDOC-10962 Fixed the issue that the formula comparison effect was incorrect.

Version: 12.11.0

Category ID Description
Bug SPIREDOC-10693 Fixes the issue that the highlighting effect was incorrect when searching.
Bug SPIREDOC-10726 Fixes the issue that the table borders were not displaying in WPS after saving doc as docx.
Bug SPIREDOC-10747 Fixes the issue that the program threw an "IllegalArgumentException" when converting Word to PDF.
Bug SPIREDOC-10755 Fixes the issue that the border properties of the table changed.
Bug SPIREDOC-10794 Fixes the issue that the column widths in tables were inconsistent after converting Word to HTML.
Bug SPIREDOC-10833 Fixes the issue that the program threw an "Unexpected table container" error when converting Word to PDF.
Bug SPIREDOC-10861 Fixes the issue that the layout was inconsistent when converting Word to HTML. 
Bug SPIREDOC-10862 Fixes the issue that the images were lost when converting RTF to PDF.
Bug SPIREDOC-10864 Fixed the issue of incorrect effect after accept the revisions.
Bug SPIREDOC-10868 Fixes the issue that the program threw the error "The string contains invalid characters" when loading Word.
Bug SPIREDOC-10822 Fixed the issue of incorrect effect when adding LaTeX formula. 

Version: 12.10.3

Category ID Description
Bug SPIREDOC-10795 Fixes issue that the TOC field was updated incorrectly.
Bug SPIREDOC-10800 Fixes the issue that the Chinese characters were garbled after converting Markdown to Word.
Bug SPIREDOC-10801 Fixes the issue that the list numbers were lost after converting Markdown to Word.

Version: 12.9.4

Category ID Description
Bug SPIREDOC-10740 Optimizes the speed of converting Word documents to PDF documents.
Bug SPIREDOC-10457 Fixes the issue that the text layout was incorrect after converting Word documents to PDF documents.
Bug SPIREDOC-10791 Fixes the issue that the created table of contents field was not updated correctly.
Bug SPIREDOC-10813 Fixes the issue that SimSun font was replaced with Times New Roman font after converting Word documents to PDF documents.
Bug SPIREDOC-10821 Fixes the issue that the program threw "Cannot find any fonts in specified font sources" exception when converting Word documents to PDF documents under the system environment where fonts were not installed.
Bug SPIREDOC-10825 Fixes the issue that the program threw java.lang.NullPointerException when using Map type parameters in MailMergeDataTable class.

Version: 12.9.0

Category ID Description
New feature SPIREDOC-7237 Supports determining if a bookmark is hidden with the new method, "bookmark.isHidden()".
New feature SPIREDOC-10287 Supports updating the character count with the new method, "document.updateWordCount()".
New feature SPIREDOC-10771 Supports embedding font files into the document when converting Word documents to HTML documents with the new method, "document.getHtmlExportOptions().setFontEmbedded(true)".
Bug SPIREDOC-10641 Fixes the issue that line spacing became inconsistent after replacing bookmark content.
Bug SPIREDOC-10671 Fixes the issue that regular format Latex formula code added to the document was converted into italic style. 
Bug SPIREDOC-10676 Fixes the issue that removing the italic style from Latex formulas did not take effect.
Bug SPIREDOC-10739 Fixes the issue that the set edit restriction password did not work in MS Word or WPS tools. 
Bug SPIREDOC-10757 Fixes the issue that garbled content appeared when converting Word documents to PDF documents.
Bug SPIREDOC-10769 Fixes the issue that the program hung when converting Markdown documents to Word documents.
Bug SPIREDOC-10771 Fixes the issue that an occasional exception occurred during stress testing of the merge mail function.

Version: 12.8.4

Category ID Description
Optimization SPIREDOC-10600 Improves clarity of images when converting Word documents to HTML.
Bug SPIREDOC-10546
SPIREDOC-10601
Fixes the issue that the images were lost when converting HTML to Word.
Bug SPIREDOC-10562 Fixes the problem that the program threw "Unknown boolex value" exception when converting Word to PDF.
Bug SPIREDOC-10688 Fixes the issue that the table borders were lost when the saved Doc document was opened in WPS tool.

Version: 12.7.17

Category ID Description
New feature SPIREDOC-10687 Supports embedding CSS and images when converting Word documents to HTML files in HTML Fixed format.
String inputFile = "1.docx";
String outputFile ="1.html";
Document doc = new Document();
doc.loadFromFile(inputFile);
doc.getHtmlExportOptions().setCssStyleSheetType(CssStyleSheetType.Internal);
doc.getHtmlExportOptions().setImageEmbedded(true);
doc.saveToFile(outputFile, FileFormat.HtmlFixed);
doc.dispose();
Bug SPIREDOC-9829
SPIREDOC-10609
Fixes the issue that the orientation of added images was incorrect.
Bug SPIREDOC-10006
SPIREDOC-10636
SPIREDOC-10692
Fixes the issue that the size of OFD documents converted from Docx documents becomes bigger.
Bug SPIREDOC-10327 Fixes the issue that watermarks in HTML documents converted from Docx documents were lost.
Bug SPIREDOC-10379
SPIREDOC-10509
SPIREDOC-10531
SPIREDOC-10650
Fixes an issue that content was lost after converting a Docx document to a PDF document.
Bug SPIREDOC-10591 Fixes an issue that the editing area was lost after converting an XML document to a Doc document.
Bug SPIREDOC-10615 Fixes the issue that the program threw an exception when converting Word to PDF under multi-threading.
Bug SPIREDOC-10623 Fixes the issue that page numbers were formatted incorrectly after converting Docx documents to PDF documents.
Bug SPIREDOC-10627 Fixes the issue that the program threw "The authentication or decryption has failed." error when converting Docx documents to PDF documents.
Bug SPIREDOC-10634
SPIREDOC-10701
Fixes the issue that the program threw an exception when converting Word to OFD under multi-threading.
Bug SPIREDOC-10670 Fixes the issue that the text orientation changed after converting Docx documents to PDF documents.
Bug SPIREDOC-10685
SPIREDOC-10697
Fixes the issue that the page numbers of requests after the second time were lost after adding a table of contents in a Web project.
Bug SPIREDOC-10713 Fixes the issue that font embedding failed when converting Docx documents to PDF documents.

Version: 12.7.6

Category ID Description
Bug SPIREDOC-10082
SPIREDOC-10362
Fixes the issue that the content layout was not correct after converting RTF to PDF and Word.
Bug SPIREDOC-10444 Fixes the issue that the content was lost after loading and saving RTF.
Bug SPIREDOC-10461 Fixes the issue that the program threw "For input string: 20" error when loading RTF.
Bug SPIREDOC-10462 Fixes the issue that the program threw "Index 4 out of bounds for length 4" error when loading RTF.

Version: 12.6.2

Category ID Description
New feature SPIREDOC-10465 Supports displaying a prompt message when a corresponding font is not found during Word conversion.
Document doc = ConvertUtil.GetNewEngineDocument();
doc.loadFromFile(input);
HandleDocumentSubstitutionWarnings substitutionWarningHandler = new HandleDocumentSubstitutionWarnings();
doc.setWarningCallback(substitutionWarningHandler);
doc.saveToFile(output_1);
StringBuilder sb = new StringBuilder();
Iterator iterator = substitutionWarningHandler.FontWarnings.iterator();
while(iterator.hasNext()){
    System.out.println(((WarningInfo)iterator.next()).getDescription());
}
String s = substitutionWarningHandler.FontWarnings.get(0).getDescription();
WarningSource warningSource = substitutionWarningHandler.FontWarnings.get(0).getSource();
substitutionWarningHandler.FontWarnings.clear(); 
class HandleDocumentSubstitutionWarnings implements IWarningCallback
{
    public void warning(WarningInfo info) {
        if(info.getWarningType() == WarningType.Font_Substitution)
            FontWarnings.warning(info);
    }
    public WarningInfoCollection FontWarnings = new WarningInfoCollection();
}
Bug SPIREDOC-10413 Fixes the issue that the text shifted upwards when converting a Word document to PDF.
Bug SPIREDOC-10486 Fixes the issue that the content layout was inconsistent when converting a Word document to PDF.
Bug SPIREDOC-10504 Fixes the issue that the application threw a "'td' is expected" error when converting an HTML to Word.
Bug SPIREDOC-10589 Fixes the issue that text content was partially lost when converting a Word document to an image.
Bug SPIREDOC-10592 Fixes the issue that the application threw a "String index out of range: -1" error when converting a Word document to PDF

Version: 12.5.1

Category ID Description
New feature SPIREDOC-10156 Supports ignoring headers and footers when comparing PDF documents.
CompareOptions options=new CompareOptions();
Options.IgnoreHeadersAndFooters=true;//Default is false
Bug SPIREDOC-9330
SPIREDOC-10446
Fixes the issue that the text was garbled after converting a DOCX document to a PDF document.
Bug SPIREDOC-9309 Fixes the issue that the content was messed up after converting a DOCX document to a PDF document.
Bug SPIREDOC-9349 Fixes the issue that the content appeared different when it was opened with WPS tool after loading and saving the document.
Bug SPIREDOC-10137 Fix the issue that the text direction of the vertical text box was incorrect after converting a Word document to a PDF document.
Bug SPIREDOC-10373 Fix the issue that the program threw "cannot be cast to java.lang.Float" exception when comparing Word documents.
Bug SPIREDOC-10383 Fixed the issue that the paragraph alignment was incorrect after converting HTML to Word documents.
Bug SPIREDOC-10408 Fixed the issue that the program threw "Specified argument was out of the range of valid values" exception when loading Word documents.
Bug SPIREDOC-10455 Fix the issue that paging was incorrect after converting Word documents to PDF documents using WPS rules.
Bug SPIREDOC-10459 Fixed the issue that images were rotated after converting Word documents to PDF documents.
Bug SPIREDOC-10466 Fix the issue that extra content appeared after converting Word documents to PDF documents.
Bug SPIREDOC-10481 Fix the problem that the program threw a "NullPointerException" when converting Word documents to PDF documents.
Bug SPIREDOC-10485 Fix the issue that extra blank pages appeared after converting Word documents to PDF documents using WPS rules.
Bug SPIREDOC-10513 Fix the issue that the content of the drop-down box was garbled after converting a Word document to a PDF document.
Request free customized demo just for you.

Tab 1

Upload

Maximum file size: 1 MB. Files accepted: doc, docx, txt, rtf.
Click here to browse files.
fileerrors

Convert to

Source file:
filename
Target file type:

Tab 2

Upload

Maximum file size: 1 MB. Files accepted: doc, docx, txt, rtf.
Click here to browse files.
fileerrors

Convert to

Source file:
filename
Search Text:

Tab 3

Tab 4

Data

e-iceblue

Option

Header Back Color:
Row Back Color:
Alternation Back Color:
Border Color:
downloads

Tab 5

Agreement Start Date:
Agreement End Date:
Agreement Extension Date:
Documentation Start Date:
Documentation End Date:
downloads

Tab 6

Upload

Maximum file size: 1 MB. Files accepted: doc, docx, txt, rtf.
Click here to browse files.
Source file:
filename
fileerrors

Set text watermark

Text:
Font:
Font Size:
Color:
downloads

Set image watermark

Image:
Click here to browse files
downloads

If you don't find the function you want, please fill in a form to request a free demo from us. Make sure the demo you want meets the following requirements:

  • It is a small project that implements a particular scenario.
  • It relates to our libraries stored on E-iceblue online store.
  • It costs less than 2 hours for us to complete it.
  • It is not a bug report.
  • It is not a feature request.