Spire.Office for Java is an enterprise-grade Java Office API suite, combining six powerful libraries: Spire.Doc, Spire.XLS, Spire.Presentation, Spire.PDF , Spire.Barcode, and Spire.OCR. This unified solution enables creation, editing, conversion, and printing of Word, Excel, PowerPoint, and PDF files, alongside with barcode generation/scanning and OCR text recognition.

As a fully independent Office Java library, Spire.Office for Java requires no Microsoft Office installation. It delivers seamless, cross-platform functionality, streamlining complex workflows like report generation, spreadsheet manipulation, scanned text extraction, and barcode decoding—all within a single toolkit designed for enterprise Java applications.
Below is a summary of the changes included in this release.
Spire.Doc for Java
| Category | ID | Description |
| Optimization | - | Deprecated the Document.getListStyles() property, replaced it with Document.getListReferences(). |
| Optimization | - | Removed the public constructors of ListStyle. Added StyleCollection.add(ListType listType, string name) to create a ListStyle.
ListStyle listStyle = document.getStyles().add(ListType.Numbered, "levelstyle");
listStyle.isCustomStyle(true);
ListLevelCollection levels = listStyle.getListRef().getLevels();
levels.get(0).setPatternType(ListPatternType.Arabic);
levels.get(0).setStartAt(1);
levels.get(0).getCharacterFormat().setFontName("Trebuchet MS");
|
| Optimization | - | Updated the method for applying a ListStyle to a paragraph.
paragraph.getListFormat().applyStyle(ListStyle listStyle);
paragraph.getListFormat().setListLevelNumber(int leverNumber)
or
paragraph.getListFormat().applyListRef(ListDefinitionReference list, int leverNumber);
|
| Optimization | - | Removed the ListFormat.getCurrentListStyle() method, replaced it with ListFormat.getCurrentListRef(). |
| New feature | - | Added the add(ListTemplate template) method to ListCollection to create multi-level lists from built-in templates.
Document document = new Document();
Section sec = document.addSection();
Paragraph paragraph = sec.addParagraph();
// Create default bullet list template
ListTemplate template = ListTemplate.Bullet_Default;
ListDefinitionReference listRef = document.getListReferences().add(template);
// Create default numbered list template
ListTemplate template1 = ListTemplate.Number_Default;
listRef = document.getListReferences().add(template1);
listRef.getLevels().get(2).setStartAt(4);// Set the third level to start at number 4
// Add paragraph and apply numbered list style (level 2)
paragraph = sec.addParagraph();
paragraph.appendText("List Item 1");
// Apply level 2 (index starts at 0; 1 means the second level)
paragraph.getListFormat().applyListRef(listRef, 1);
paragraph = sec.addParagraph();
paragraph.appendText("List Item 2");
// Apply level 3
paragraph.getListFormat().applyListRef(listRef, 2);
paragraph = sec.addParagraph();
paragraph.appendText("List Item 3");
// Apply level 2
paragraph.getListFormat().applyListRef(listRef, 1);
paragraph = sec.addParagraph();
paragraph.appendText("List Item 4");
// Apply level 3
paragraph.getListFormat().applyListRef(listRef, 2);
document.saveToFile(outputFile, FileFormat.Docx);
document.close();
|
| New feature | - | Added the addSingleLevelList(ListTemplate listTemplate) method to ListCollection for quickly creating single-level lists.
Document document = new Document();
Section sec = document.addSection();
Paragraph paragraph = sec.addParagraph();
// Create Arabic numeral numbered list template (e.g., "1.", "2.", ...)
ListTemplate template = ListTemplate.Number_Arabic_Dot;
// Use addSingleLevelList to create a single-level list reference
ListDefinitionReference listRef = document.getListReferences().addSingleLevelList(template);
int levelcount = listRef.getLevels().getCount();//Check level count
boolean res=listRef.isMultiLevel();
// Add first list item
paragraph = sec.addParagraph();
paragraph.appendText("List Item 1");
paragraph.getListFormat().applyListRef(listRef, 0);
paragraph = sec.addParagraph();
paragraph.appendText("List Item 2");
paragraph.getListFormat().applyListRef(listRef, 0);
document.saveToFile(outputFile, FileFormat.Docx);
document.close();
|
| New feature | - | Added the ListLevel.equals(ListLevel level) method to compare whether two ListLevel objects are equal. |
| New feature | - | Added methods for creating, retrieving, and deleting picture bullets.
Document document = new Document();
Section sec = document.addSection();
Paragraph paragraph = sec.addParagraph();
// Create custom bulleted list style
ListStyle listStyle = document.getStyles().add(ListType.Bulleted, "bulletList");
// Get level configurations of this list style
ListLevelCollection Levels = listStyle.getListRef().getLevels();
// Set picture bullet for level 1
Levels.get(0).createPictureBullet();
Levels.get(0).getPictureBullet().loadImage(imag_Path_1);
// Set picture bullet for level 2
Levels.get(1).createPictureBullet();
Levels.get(1).getPictureBullet().loadImage(imag_Path_2);
// Add first list item
paragraph = sec.addParagraph();
paragraph.appendText("List Item 1");
paragraph.getListFormat().applyStyle(listStyle);
// Add second list item
paragraph = sec.addParagraph();
paragraph.appendText("List Item 1.1");
paragraph.getListFormat().applyStyle(listStyle);
paragraph.getListFormat().setListLevelNumber(1);
// Delete picture bullet for level 1
Levels.get(0).deletePictureBullet();
document.saveToFile(outputFile, FileFormat.Docx);
document.close();
|
| New feature | SPIREDOC-11582 | Added the removeSelf() method to support removing a style.
document.getStyles().get("style1").removeSelf();
|
| New feature | SPIREDOC-11583 | Supports applying custom styles to tables.
Document doc = new Document();
Section section = doc.addSection();
TableStyle tableStyle = (TableStyle) doc.getStyles().add(StyleType.Table_Style, "TestTableStyle1");
tableStyle.setHorizontalAlignment(RowAlignment.Center);
tableStyle.getBorders().setColor(Color.BLUE);
tableStyle.getBorders().setBorderType(BorderStyle.Single);
Table table = section.addTable();
table.resetCells(1, 1);
table.getRows().get(0).getCells().get(0).addParagraph().appendText("Aligned to the center of the page");
table.setPreferredWidth(PreferredWidth.fromPoints(300));
table.applyStyle(tableStyle);
// table.getFormat().setStyle(tableStyle);
doc.saveToFile(outputDocxFile, FileFormat.Docx);
|
| New feature | SPIREDOC-11748 | Supports cloning styles from a template document.
doc.copyStylesFromTemplate(inputFile_2); // Accepts file path as String
doc.copyStylesFromTemplate(doc2); // Accepts another Document object
|
| Bug Fix | SPIREDOC-10843 | Fixed an issue where the application hung when processing a structured document. |
| Bug Fix | SPIREDOC-11439 | Fixed an issue where the comparison of the table of contents failed. |
| Bug Fix | SPIREDOC-11532 | Fixed an issue where the application hung when converting Word to PDF. |
| Bug Fix | SPIREDOC-11605 SPIREDOC-11712 | Fixed an issue where the table layout was incorrect when converting Word to PDF. |
| Bug Fix | SPIREDOC-11629 | Fixed an issue where text positioning was incorrect when converting Word to PDF. |
| Bug Fix | SPIREDOC-11699 | Fixed an issue where text line wrapping was incorrect when converting Word to PDF while following WPS rules. |
| Bug Fix | SPIREDOC-11709 | Fixed an issue where the application hung when converting MHT to PDF. |
| Bug Fix | SPIREDOC-11741 | Fixed an issue that Avira Free Security Suite falsely detected a virus in spire.doc.jar. |
| Bug Fix | SPIREDOC-10278 | Fixes the issue where paragraph indentation was incorrect when converting Word to PDF. |
| Bug Fix | SPIREDOC-11142 | Fixes the issue where image layout inside tables was rendered incorrectly during Word-to-PDF conversion. |
| Bug Fix | SPIREDOC-11688 | Fixes the issue where Word-to-PDF conversion did not correctly apply formatting rules specific to WPS Office. |
| Bug Fix | SPIREDOC-11714 | Fixes a NullPointerException that occurred when converting Word to Markdown. |
| Bug Fix | SPIREDOC-11718 | Fixes a NullPointerException that occurred during Word-to-PDF conversion. |
| Bug Fix | SPIREDOC-11734 | Fixes the issue where the application would hang when updating TOC (Table of Contents) fields. |
| Bug Fix | SPIREDOC-11735 | Fixes the issue where page number fields failed to update correctly. |
| Bug Fix | SPIREDOC-11757 | Fixes an IllegalStateException ("Unexpected ST_TrueFalse value") during Word-to-PDF conversion. |
Spire.XLS for Java
| Category | ID | Description |
| New feature | SPIREXLS-5237 | Added support for inserting, retrieving, and updating equations.
// Insert an equation
sheet.getEquations().addEquation(11, 0, 100, 100, "x_{1}^{2}");
// Retrieve an equation
String mathML = sheet.getEquations().get(0).exportMathML();
String latex = sheet.getEquations().get(0).exportLaTeX();
// Update an equation
IXlsEquation equation1 = sheet.getEquations().get(0);
equation1.updateByLaTeXText("egin{pmatrix}
1 & 0 \
0 & 1
end{pmatrix}
left(x-1
ight)left(x+3
ight)");
|
| New feature | SPIREXLS-6047 | Added support for the F.INV function.
worksheet.getCellRange("A2").setFormula("=F.INV(0.99, 100, 200)");
|
| New feature | SPIREXLS-6048 | Added support for the T.INV.2T function.
worksheet.getCellRange("A2").setFormula("=T.INV.2T(0.05, 10)");
|
| Bug Fix | SPIREXLS-6045 | Fixed an issue where an “ArrayIndexOutOfBoundsException” was thrown when converting HTML to Excel. |
| Bug Fix | SPIREXLS-6053 | Fixed an issue where formula calculation took an excessively long time. |
| Bug Fix | SPIREXLS-6056 | Fixed an issue where formulas displayed an unexpected blue background when converting XLSX to XLS. |
| Bug Fix | SPIREXLS-6058 | Fixed an issue where extra borders appeared in the output when converting Excel to PDF. |
| Bug Fix | SPIREXLS-6062 | Fixed an issue where a “NullPointerException” occurred when saving XLS files to XLSX format. |
| Bug Fix | SPIREXLS-6064 | Fixed an issue where copying cell content containing embedded images to another Excel workbook failed. |
| Bug Fix | SPIREXLS-6066 | Fixed an issue where a “NullPointerException” was thrown during Excel-to-PDF conversion. |
| Bug Fix | SPIREXLS-6067 | Fixed an issue where local image files could not be deleted after inserting pictures into Excel due to unreleased file handles. |
Spire.PDF for Java
| Category | ID | Description |
| New feature | SPIREPDF-7880 | Added support for saving PDF comparison results to file streams.
// Create a new PdfDocument object 'pdf1' to work with the first PDF file
PdfDocument pdf1 = new PdfDocument();
// Load the first PDF file from the specified path
pdf1.loadFromFile("ComparePdfDocument_1.pdf");
// Create a new PdfDocument object 'pdf2' to work with the second PDF file
PdfDocument pdf2 = new PdfDocument();
// Load the second PDF file from the specified path
pdf2.loadFromFile("ComparePdfDocument_2.pdf");
// Create a PdfComparer object 'compare' with 'pdf1' and 'pdf2' as parameters for comparison
PdfComparer compare = new PdfComparer(pdf1, pdf2);
// Set the page ranges to be compared using the options of the comparer
compare.getOptions().setPageRanges(0, pdf1.getPages().getCount() - 1, 0, pdf2.getPages().getCount() - 1);
String result = "output.pdf";
File outFile = new File(result);
// Create an output stream to write the document to the output file
OutputStream outputStream = new FileOutputStream(outFile);
// Compare the PDF documents and save
compare.compare(outputStream);
// Dispose of system resources associated with 'pdf1'
pdf1.dispose();
// Dispose of system resources associated with 'pdf2'
pdf2.dispose();
|
| Bug Fix | SPIREPDF-6373 | Optimized performance when converting PDF documents to images. |
| Bug Fix | SPIREPDF-6406 | Fixed an OutOfMemoryError that occurred during OFD to PDF conversion. |
| Bug Fix | SPIREPDF-7189 | Improved the rendering quality of PDF to Word conversion results when opened in WPS. |
| Bug Fix | SPIREPDF-7305 | Fixed inconsistent background colors and partial font rendering issues when printing PDFs. |
| Bug Fix | SPIREPDF-7407 | Enhanced layout accuracy when converting PDFs to flowable Word documents. |
| Bug Fix | SPIREPDF-7560 | Resolved an error related to PdfTrueTypeFont in multi-threaded environments. |
| Bug Fix | SPIREPDF-7666 | Fixed incorrect content generation when using the "Yu Mincho" font. |
| Bug Fix | SPIREPDF-7687 | Fixed text misalignment issues in PDF to PDF/A-1A conversion. |
| Bug Fix | SPIREPDF-7782 | Fixed extra spaces appearing in extracted table content. |
| Bug Fix | SPIREPDF-7820 | Resolved missing formulas when converting PDF documents to images. |
| Bug Fix | SPIREPDF-7869 | Fixed overlapping text issues in PDF to HTML conversion. |
| Bug Fix | SPIREPDF-7887 | Resolved the "structure is not valid" error when loading PDF documents. |
| Bug Fix | SPIREPDF-7890 | Fixed an ArrayIndexOutOfBoundsException that occurred when saving PDFs after adding text watermarks. |
| Bug Fix | SPIREPDF-7898 | Fixed content inconsistency issues during SVG to PDF conversion. |
| Bug Fix | SPIREPDF-7910 | Resolved an error ("For input string: '36.8s'") during OFD to PDF conversion. |
| Bug Fix | SPIREPDF-7911 | Fixed incorrect content issues in OFD to PDF conversion. |
Spire.Presentation for Java
| Category | ID | Description |
| New feature | - | Added support for reading customer data from shapes.
Presentation ppt = new Presentation();
ppt.loadFromFile(inputFile);
List dataList = ppt.getSlides().get(0).getShapes().get(0).getCustomerDataList();
System.out.println(dataList.size());
for(int i = 0; i < dataList.size(); i++)
{
String name = dataList.get(i).getName();
String content = dataList.get(i).getXML();
}
|
| New feature | - | Added support for setting audio fade-in and fade-out durations.
Presentation ppt = new Presentation();
ppt.loadFromFile(inputFile);
Rectangle2D.Double audioRect = new Rectangle2D.Double(220, 240, 80, 80);
IAudio audio=ppt.getSlides().get(0).getShapes().appendAudioMedia(inputFile_1, audioRect);
// Set the duration of the starting fade for 13s
audio.setFadeInDuration(13000f);
// Set the duration of the ending fade for 20s
audio.setFadeOutDuration(20000f);
ppt.saveToFile(outputFile, FileFormat.PPTX_2016);
ppt.dispose();
|
| New feature | - | Added support for trimming audio playback range.
Presentation ppt = new Presentation();
ppt.loadFromFile(inputFile);
Rectangle2D.Double audioRect = new Rectangle2D.Double(220, 240, 80, 80);
IAudio audio=ppt.getSlides().get(0).getShapes().appendAudioMedia(inputFile_1, audioRect);
// Set the start trimming time 8 seconds
audio.setTrimFromStart(8000f);
// Set the end trimming time 13 seconds
audio.setTrimFromEnd(13000f);
ppt.saveToFile(outputFile, FileFormat.PPTX_2016);
ppt.dispose();
|
| New feature | - | Added support for setting table transparency.
Presentation presentation = new Presentation();
presentation.loadFromFile("data/test.pptx");
Double[] widths = new Double[]{100d, 100d, 150d, 100d, 100d};
Double[] heights = new Double[]{15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d, 15d};
// Add a table
ITable table = presentation.getSlides().get(0).getShapes().appendTable(
(float) presentation.getSlideSize().getSize().getWidth() / 2 - 275, 90, widths, heights);
// Set overall table background transparency to 50% (0.0 = opaque, 1.0 = fully transparent)
table.getFill().setTransparency(0.5f);
// Customize the fill color of the cell at row 0, column 0 to blue
table.get(0, 0).getFillFormat().setFillType(FillFormatType.SOLID);
table.get(0, 0).getFillFormat().getSolidColor().setColor(Color.BLUE);
presentation.saveToFile("result.pptx", FileFormat.PPTX_2016);
|
| New feature | SPIREPPT-2349 SPIREPPT-2950 | Added support for parsing WEBP format images during conversions. |
| Bug Fix | SPIREPPT-3035 | Fixed the issue where adding a LaTeX formula caused the application to throw a "NullPointerException". |
| Bug Fix | SPIREPPT-3056 | Fixed the issue where a false positive virus alert was triggered by Avira Security Suite for spire.presentation.jar. |
| Bug Fix | SPIREPPT-3069 | Fixed the issue where adding the "dots" formula caused a "NullPointerException" error. |
| Bug Fix | SPIREPPT-3071 | Fixed the issue with inconsistent content when converting PPT to PDF. |