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 image, hyperlink, digital signature, bookmark and watermark, setting header and footer, creating table, setting background image, and adding footnote and endnote.


In addition, Spire.Doc for Java supports file format conversions from Word to PDF, XPS, Image, EPUB, HTML, TXT, ODT, RTF, WordML, WordXML and many more.

  • 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

Conversion 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, Image, EPUB, HTML, TXT, ODT, RTF, WordML, WordXML 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, TOC, form field, mail merge, hyperlink, bookmark, watermark, image, style, shape, textbox, ole, WordArt, background settings, digital signature, document encryption 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 support@e-iceblue.com 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 sales@e-iceblue.com

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 sales@e-iceblue.com.

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.3.1

Category ID Description
Improvement SPIREDOC-10325 Optimizes the file size of the resulting document of Word to OFD conversion.
New feature - Adds the setImageLink() in MergeImageFieldEventArgs event to support adding hyperlinks to the mail merge images.
Document document = new Document();
 document.loadFromFile(inputFile);
 String[] fieldNames = new String[]{"ImageFile"};
 String[] fieldValues = new String[]{inputFile_img};
 document.getMailMerge().MergeImageField = new MergeImageFieldEventHandler() {
     @Override
     public void invoke(Object sender, MergeImageFieldEventArgs args) {
         mailMerge_MergeImageField(sender, args);
     }
 };
 document.getMailMerge().execute(fieldNames, fieldValues);
 document.saveToFile(outputFile, FileFormat.Docx);
private static void mailMerge_MergeImageField(Object sender, MergeImageFieldEventArgs field) {
    String filePath = field.getImageFileName();
    if (filePath != null && !"".equals(filePath)) {
        try {
            field.setImage(filePath);
            field.setImageLink("https://www.baidu.com/");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
New feature SPIREDOC-9369 Adds the getFieldOptions() method to support setting field properties when updating a field.
document.getFieldOptions().setCultureSource(FieldCultureSource.CurrentThread);
New feature - Adds the hasDigitalSignature() method to support determining whether a document has a digital signature.
Document.hasDigitalSignature("filepath");
New feature SPIREDOC-9455 Adds the integrateFontTableTo method to support copying Fonttable data from source document to target document.
sourceDoc.integrateFontTableTo(Document destDoc);
New feature SPIREDOC-9869 Adds the HtmlUrlLoadEvent event to support the control of loading URLs in the file when loading HTML files.
public static void main(String[] args) {
    Document document = new Document();
    document.HtmlUrlLoadEvent = new MyDownloadEvent();
    document.loadFromFile(inputFile, FileFormat.Html, XHTMLValidationType.None);
    document.saveToFile(outputFile, FileFormat.PDF);
}
static class MyDownloadEvent extends HtmlUrlLoadHandler {
    @Override
    public void invoke(Object o, HtmlUrlLoadEventArgs htmlUrlLoadEventArgs) {
        try {
            byte[] bytes = downloadBytesFromURL(htmlUrlLoadEventArgs.getUrl());
            htmlUrlLoadEventArgs.setDataBytes(bytes);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
public static byte[] downloadBytesFromURL(String urlString) throws Exception {
    URL url = new URL(urlString);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.setRequestMethod("GET");
    connection.setConnectTimeout(5000);
    connection.setReadTimeout(5000);
    int responseCode = connection.getResponseCode();
    if (responseCode == HttpURLConnection.HTTP_OK) {
        InputStream inputStream = connection.getInputStream();
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        byte[] buffer = new byte[1024];
        int bytesRead;
        while ((bytesRead = inputStream.read(buffer)) != -1) {
            outputStream.write(buffer, 0, bytesRead);
        }
        outputStream.close();
        return outputStream.toByteArray();
    } else {
        throw new Exception("Failed to download content. Response code: " + responseCode);
    }
}
New feature - Adds the setCustomFonts(InputStream[] fontStreamList) method to support setting custom fonts by stream.
document.setCustomFonts(InputStream[] fontStreamList);
New feature - Replaces the clearCustomFontsFolders() method with the new clearCustomFonts() method.
document.clearCustomFonts();
New feature - Replaces the setGlobalCustomFontsFolders(InputStream[] fontStreamList) method with the new setGlobalCustomFonts(InputStream[] fontStreamList) method.
Document.setGlobalCustomFonts(InputStream[] fontStreamList);
New feature - Replaces the clearGlobalCustomFontsFolders() method with the new clearGlobalCustomFonts() method.
Document.clearGlobalCustomFonts();

Version: 12.2.2

Category ID Description
Bug SPIREDOC-9689 Fixes the issue that extra red vertical lines appeared after converting a Word document to a PDF document.
Bug SPIREDOC-9911 Fixes the issue that text loss occurred after converting an RTF document to a PDF document.
Bug SPIREDOC-10009 Fixes the issue that the program threw java.lang.NullPointerException when converting the same Word document to PDF document more than once under multi-threading.
Bug SPIREDOC-10018 Fixes the issue that the content was incorrect after converting a Word document to a PDF document.
Bug SPIREDOC-10031 Fixes the issue that the size of the PDF file was inconsistent when converting the same Word document to PDF document multiple times under multi-threading.
Bug SPIREDOC-10130 Fixes the issue that the numbers in the header were displayed incorrectly after converting a Word document to a PDF document.
Bug SPIREDOC-10216 Fixes the issue that the content of the updated table of contents was incorrect.
Bug SPIREDOC-10236 Fixes the issue that the program threw java.lang.NullPointerException when converting Word documents to PDF documents.
Bug SPIREDOC-10238 Fixes the issue that the text was garbled after converting a Doc document to a Docx document.
Bug SPIREDOC-10258 Fixes the issue that the program threw multiple exceptions when loading multiple files in a folder under multi-threading.
Bug SPIREDOC-10274 Fixes the issue that extra slashes appeared after converting a Word document to a PDF document.
Bug SPIREDOC-10276 Fixes the issue that the content of the header was displayed repeatedly after unlinking the header to the previous section.

Version: 12.1.16

Category ID Description
New feature SPIREDOC-10090 Addes the Bookmark.getFirstColumn() method and the Bookmark.getLastColumn() method.
New feature SPIREDOC-10163 Optimizes the exception catching mechanism when loading non-existent document paths.
Bug SPIREDOC-8257 Fixed the issue that the paging was incorrect when converting Docx documents to PDF documents.
Bug SPIREDOC-8568
SPIREDOC-9172
Fixed the issue that the content was incorrect when converting Docx documents to PDF documents.
Bug SPIREDOC-8586 Fixed the issue that the header moved down when converting Docx documents to PDF documents.
Bug SPIREDOC-8797 Fixed the issue that combined graphics were drawn incorrectly when converting Docx documents to HTML documents.
Bug SPIREDOC-9069 Fixed the issue that checkbox checkmarks were missing and an extra page occurred when converting Docx documents to PDF documents.
Bug SPIREDOC-9577 Fixed the issue that the program threw java.lang.ArrayIndexOutOfBoundsException when converting Docx documents to PDF documents.
Bug SPIREDOC-9611 Fixed the issue that some contents were lost and the formatting was incorrect when converting Docx documents to PDF documents.
Bug SPIREDOC-9709 Fixed the issue that the program threw "No have this value 63" error when loading Doc documents.
Bug SPIREDOC-9713 Fixed the issue that the position of pictures was wrong when converting Doc documents to PDF documents.
Bug SPIREDOC-9763 Fixed the issue that the effect of accepting revisions was incorrect.
Bug SPIREDOC-9783 Fixed the issue that images and text overlapped when converting Docx documents to PDF documents.
Bug SPIREDOC-9799 Fixed the issue that fonts and paragraph styles were changed after replacing the contents of bookmarks.
Bug SPIREDOC-10011 Fixed the issue that header contents were displayed incorrectly after converting Docx documents to PDF documents.
Bug SPIREDOC-10015 Fixed the issue that table styles were incorrect when converting Docx documents to PDF documents.
Bug SPIREDOC-10040 Fix the issue that the program threw an "Argument path cannot be empty" error when converting Docx documents to PDF documents.
Bug SPIREDOC-10054 Fixed the issue that images are displayed incorrectly when converting Docx documents to PDF documents.
Bug SPIREDOC-10074 Fixed the issue that tables were lost and table height was increased when converting Doc documents to PDF documents.
Bug SPIREDOC-10143 Fixed the issue that the program threw "java.lang.IllegalStateException: Wrong Word version" error when loading Docx documents encrypted with WPS.
Bug SPIREDOC-10148 Fixed the issue that directory jumps were incorrect when converting Docx documents to PDF documents.
Bug SPIREDOC-10157 Fixed an issue that the markup adding to a document using the BuiltinDocumentProperties.setKeyWord() method failed.
Bug SPIREDOC-10179 Fixed the issue that page number formatting changed after converting a Docx document to a PDF document.

Version: 12.1.0

Category ID Description
Adjustment - Changes the namespace com.spire.ms.Printing.* to com.spire.doc.printing.*
Bug SPIREDOC-8618 Fixes the issue that the program threw "Error loading file: Unsupported file format" exception when converting Doc to Docx.
Bug SPIREDOC-8694 Fixes the issue that the position of the shape was shifted when converting Word to PDF.
Bug SPIREDOC-8779 Fixes the issue that the program threw "java.lang.OutOfMemoryError" exception when converting Word to PDF.
Bug SPIREDOC-8981 Fixes the issue that there were extra borders around images when converting Word to PDF.
Bug SPIREDOC-9321 Fixes the issue that the table width was incorrect when converting Word to PDF.
Bug SPIREDOC-9426
SPIREDOC-9427
SPIREDOC-9953
SPIREDOC-9964
SPIREDOC-10131
Fixes the issue that the pagination was incorrect when converting Word to PDF.
Bug SPIREDOC-9465 Fixes the issue that the content was lost when converting Doc to XML.
Bug SPIREDOC-9551 Fixes the issue that the program hung when saving document data to a memory stream.
Bug SPIREDOC-9633 Fixes the issue that text became garbled when converting Word to PDF.
Bug SPIREDOC-9695 Fixes the issue that the program threw "This is not a structured storage file." exception when converting Word to a PDF.
Bug SPIREDOC-9874 Fixes the issue that the table styles were incorrect when converting Word to PDF.
Bug SPIREDOC-9917
SPIREDOC-9937
Fixes the issue that the program threw "java.lang.AssertionError" exception when converting Word to PDF.
Bug SPIREDOC-9951 Fixes the issue that the content was lost when converting Word to PDF.
Bug SPIREDOC-9968 Fixes the issue that the table format was incorrect after adding new rows and merging rows.
Bug SPIREDOC-9984 Fixes the issue that the program threw "java.lang.NullPointerException" exception when converting Word to PDF.
Bug SPIREDOC-10041 Fixes the issue that the program threw "java.lang.ClassCastException" exception when converting Word to PDF.
Bug SPIREDOC-10075 Fixes the issue that the formulas could not be edited after merging Word documents.
Bug SPIREDOC-10076 Fixes the issue that the chart data format was incorrect when converting Word to PDF.
Bug SPIREDOC-10115 Fixes the issue that the program threw "java.lang.NullPointerException" exception when loading a Word document.
Bug SPIREDOC-10125 Fixes the issue that the background of some content was blackened after setting a document password protection.
Bug SPIREDOC-10136 Fixes the issue that the tables were misaligned after splitting cells.

Version: 12.1.0

Category ID Description
Adjustment - Removes the dependency on Spire.Pdf.jar.
Adjustment - Changes the method of license application to "com.spire.doc.license.LicenseProvider.setLicenseKey(key)".
New feature - Deprecates the following methods, classes and interfaces.
The "newEngine" parameter in the Document constructor no longer has any effect. The internal mechanism now defaults to using the new engine.
The HeaderType enum.
The GroupedShapeCollection class.
The ShapeObjectTextCollection class.
The MailMergeData interface.
The EnumInterface interface.
The public PictureWaterMark(InputStream inputeStream, boolean washout) constructor.
The public PictureWaterMark(String filename, boolean washout) constructor.
The downloadImage method in the Field class.
The IDocOleObject interface.
The PointsConverter class.
New feature - Deprecates the "getWidth()" and "setWidth()" methods in the TableCell class and replaces them with the "getCellWidth()" and "setCellWidth()" methods.
New feature - Changes the following namespaces.
com.spire.license.LicenseProvider -> com.spire.doc.License.LicenseProvider
New feature - Changes the inheritance relationship: changes "ShapeGroup implements ShapeObject" to "ShapeGroup implements ShapeBase".
New feature - Supports destroying data related to customized fonts when destroying the Document at the same time.
// Set custom fonts
Document.setCustomFontsFolders(string filePath);

// Dispose of custom fonts
Document.clearCustomFontsFolders();

// Clear system font cache that occupies memory in the cache
Document.clearSystemFontCache();

Example code:
Document doc = new Document();
doc.loadFromFile("inputFile.docx");
doc.setCustomFontsFolders(@"d:\Fonts");
doc.saveToFile("output.pdf", FileFormat.PDF);
doc.close();
doc.dispose();
New feature - Changes the following enumerated classes.
com.spire.doc.FileFormat.WPS -> com.spire.doc.FileFormat.Wps
com.spire.doc.FileFormat.WPT -> com.spire.doc.FileFormat.Wpt
ComparisonLevel -> TextDiffMode
New feature - Changes the following methods.
ComparisonLevel getLevel() -> getTextCompareLevel()
setLevel(ComparisonLevel value) -> setTextCompareLevel(TextDiffMode)
IsPasswordProtect() -> isEncrypted()
getFillEfects() -> getFillEffects()
New feature - Adds a new method to add image watermark.
File imageFile = new File("data/E-iceblue.png");
BufferedImage bufferedImage = ImageIO.read(imageFile);
// Create a new instance of the PictureWatermark class with the input BufferedImage, and set the scaling factor for the watermark image
PictureWatermark picture = new PictureWatermark(bufferedImage,false);
		// Or another way to create PictureWatermark
		// PictureWatermark picture = new PictureWatermark();
		// picture.setPicture(bufferedImage);
		// picture.isWashout(false);
		// Set the scaling factor for the watermark image
picture.setScaling(250);
// Set the watermark to be applied to the document
document.setWatermark(picture);
New feature - shape exposes the "getFill()" method to manipulate the fill of a shape; please use "getFill().setOn(false)" instead of "setFillColor(null)".
New feature - Supports adding charts.
// Create a new instance of Document
Document document = new Document();

// Add a section to the document
Section section = document.addSection();

// Add a paragraph to the section and append text to it
section.addParagraph().appendText("Line chart.");

// Add a new paragraph to the section
Paragraph newPara = section.addParagraph();

// Append a line chart shape to the paragraph with specified width and height
ShapeObject shape = newPara.appendChart(ChartType.Line, 500, 300);

// Get the chart object from the shape
Chart chart = shape.getChart();

// Get the title of the chart
ChartTitle title = chart.getTitle();

 // Set the text of the chart title
title.setText("My Chart");

 // Clear any existing series in the chart
ChartSeriesCollection seriesColl = chart.getSeries();
seriesColl.clear();

// Define categories (X-axis values)
String[] categories = { "C1", "C2", "C3", "C4", "C5", "C6" };

// Add two series to the chart with specified categories and Y-axis values
seriesColl.add("AW Series 1", categories, new double[] { 1, 2, 2.5, 4, 5, 6 });
seriesColl.add("AW Series 2", categories, new double[] { 2, 3, 3.5, 6, 6.5, 7 });

 // Save the document to a file in Docx format
document.saveToFile("AppendLineChart.docx", FileFormat.Docx_2016);

// Dispose of the document object when finished using it
document.dispose();
New feature - Provides the page model "Spire.Doc.Pages" to get the content of the page.
// Create a new instance of Document
Document doc = new Document();

// Load the document from the specified file
doc.loadFromFile(inputFile);

// Create a FixedLayoutDocument object using the loaded document
FixedLayoutDocument layoutDoc = new FixedLayoutDocument(doc);

// Create a StringBuilder to store the extracted text
StringBuilder stringBuilder = new StringBuilder();

// Get the first line on the first page and append it to the StringBuilder
FixedLayoutLine line = layoutDoc.getPages().get(0).getColumns().get(0).getLines().get(0);
stringBuilder.append("Line: " + line.getText() + "\r
");

// Retrieve the original paragraph associated with the line and append its text to the StringBuilder
Paragraph para = line.getParagraph();
stringBuilder.append("Paragraph text: " + para.getText() + "\r
");

// Retrieve all the text on the first page, including headers and footers, and append it to the StringBuilder
String pageText = layoutDoc.getPages().get(0).getText();
stringBuilder.append(pageText + "\r
");

// Iterate through each page in the document and print the number of lines on each page
for (Object obj : layoutDoc.getPages()) {
	FixedLayoutPage page = (FixedLayoutPage) obj;
	LayoutCollection lines = page.getChildEntities(LayoutElementType.Line, true);
	stringBuilder.append("Page " + page.getPageIndex() + " has " + lines.getCount() + " lines." + "\r
");
}

// Perform a reverse lookup of layout entities for the first paragraph and append them to the StringBuilder
stringBuilder.append("\r
");
stringBuilder.append("The lines of the first paragraph:" + "\r
");

for (Object object : layoutDoc.getLayoutEntitiesOfNode(((Section) doc.getFirstChild()).getBody().getParagraphs().get(0))) {
	FixedLayoutLine paragraphLine = (FixedLayoutLine) object;

	stringBuilder.append(paragraphLine.getText().trim() + "\r
");
	stringBuilder.append(paragraphLine.getRectangle().toString() + "\r
");
	stringBuilder.append("");
}

// Write the extracted text to a file
FileWriter fileWriter = new FileWriter(new File(outputFile));
fileWriter.write(stringBuilder.toString());
fileWriter.flush();
fileWriter.close();

// Dispose of the document resources
doc.close();
doc.dispose();
New feature - Supports adding SVG graphics.
// Create a new Document object
Document document = new Document();

// Add a new Section to the document
Section section = document.addSection();

// Add a new Paragraph to the section
Paragraph paragraph = section.addParagraph();

// Append the picture (SVG) to the paragraph
paragraph.appendPicture(inputSvg);

// Save the document to the specified output file
document.saveToFile(outputFile, FileFormat.Docx_2013);

// Close the document
document.dispose();

Version: 11.12.1

Category ID Description
New feature SPIREDOC-9980 Supports setting left and right indents by character.
paragraph.getFormat().setLeftIndentChars(2.5f);
paragraph.getFormat().setRightIndentChars(5.5f);
Bug SPIREDOC-9452 Fixes the issue that there were extra blank pages when converting Word to PDF.
Bug SPIREDOC-9737 Fixes the issue that the content format was incorrect when converting RTF to PDF.
Bug SPIREDOC-9838
SPIREDOC-9913
Fixes the issue that the track changes feature didn’t work.
Bug SPIREDOC-9927 Fixes the issue that there were inconsistent row heights in cells when converting Word to PDF.
Bug SPIREDOC-9930 Fixes the issue that incorrect text color was displayed in flowcharts when converting Word to PDF.
Bug SPIREDOC-9936 Fixes the issue that item numbers were misaligned when converting RTF to Word.
Bug SPIREDOC-9955 Fixes the issue that the program threw "java.lang.IllegalArgumentException" when converting Word to HTML.
Bug SPIREDOC-9957 Fixes the issue that table borders were missing when converting HTML to Word.
Bug SPIREDOC-9962 Fixes the issue that subscript text font became smaller when converting Word to HTML.
Bug SPIREDOC-9975 Fixes the issue that setting the direction of a section to landscape didn't take effect.
Bug SPIREDOC-10030 Fixes the issue that mathematical formulas were incorrectly displayed when converting HTML to Word.
Bug SPIREDOC-10049 Fixes the issue that the program threw "Non-negative number required" when converting Word to PDF.
Bug SPIREDOC-10059 Fixes the issue that the program threw "java.lang.StringIndexOutOfBoundsException" when inserting HTML text into a Word document.
Bug SPIREDOC-9897 Fixes the issue that searching text with regular expressions failed.
Bug SPIREDOC-9857 Fixes the issue that the direction of bracket in text boxes changed when converting Word to PDF.

Version: 11.10.3

Category ID Description
New feature SPIREDOC-9912 Synchronizes the AppendHorizonalLine() method to Java.
paragraph.appendHorizonalLine()
New feature - Supports switching fonts that do not support drawing characters through the FontFallbackRule method in XML when converting to a non-flow layout document.
Document doc = new Document();
doc.loadFromFile(inputFile);
doc.saveFontFallbackRuleSettings(outputFile_xml);
doc.loadFontFallbackRuleSettings(outputFile_xml);
doc.saveToFile(outputFile, FileFormat.PDF);
Instructions:
If there is no XML available, first save an XML using saveFontFallbackRuleSettings and then manually edit the font replacement rules in the XML.
The rules consist of three attributes: Ranges correspond to Unicode ranges for each character; FallbackFonts correspond to the font names for substitution; BaseFonts correspond to the font names for characters in the document.
When editing the XML, it is important to note that the rules are searched from top to bottom for character matching.
After editing the XML, load the rules using the loadFontFallbackRuleSettings method.
Bug SPIREDOC-9711 Fixes the issue that the program threw "OutOfMemoryError" when using WPS rules to convert Word to PDF.
Bug SPIREDOC-9781 Fixes the issue that the embedding of "楷体_GB2312" font failed.
Bug SPIREDOC-9842 Fixes the issue that the Chinese characters garbled after converting RTF to PDF.
Bug SPIREDOC-9854 Fixes the issue that the editable area was changed after saving the Word document.
Bug SPIREDOC-9860 Fixes the issue that the editable area was changed after modifying Word documents.
Bug SPIREDOC-9862 Fixes the issue that the result of setting image zoom size was incorrect.
Bug SPIREDOC-9871 Fixes the issue that the table style was incorrect after converting Word to HTML.
Bug SPIREDOC-9880 Fixes the issue that the font size was incorrect after converting HTML to Word.
Bug SPIREDOC-9891 Fixes the issue that each value would be displayed twice after doing mail merging using executeWidthNestedRegion() method.
Bug SPIREDOC-9892 Fixes the issue that the file became much larger after converting Word to OFD.

Version: 11.9.5

Category ID Description
New feature SPIREDOC-9700 Optimizes the mechanism for reading documents with existing issues, so that the program throws an exception and terminates when reading such a document to avoid causing memory overflow.
Bug SPIREDOC-9156 Fixes the issue that finding text using regular expressions failed.
Bug SPIREDOC-9261 Fixes the issue that the emphasis marks were lost when converting Word to PDF.
Bug SPIREDOC-9560 Fixes the issue that

tag in HTML did not take effect when converting HTML to Docx.

Bug SPIREDOC-9752 Fixes the issue that fonts were not correct when converting Word to HTML.
Bug SPIREDOC-9815 Fixes the issue that the chart data in the result file was not correct when converting Word to PDF.
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.