News Category

Spire.Office for Java 4.12.2 is released

2021-12-22 01:46:52

We are excited to announce the release of Spire.Office for Java 4.12.2. This version brings some new features, for instance, Spire.Doc for Java supports converting Word to OFD format, setting the revision author, as well as setting "ignore formatting" when doing the comparison; Spire.PDF for Java supports converting PDF to linearized PDF, and supports that the text of cell is not wrapped when converting PDF to Excel file; Spire.Presentation supports adding math equations and checking whether shape contains math equations; Spire.XLS for Java supports converting excel file to OFD and supports "Subtotal" function. Meanwhile, a lot of bugs have been successfully fixed. More details are listed as follow.

Click the link to download Spire.Office for Java 4.12.2:

Here is a list of changes made in this release

Spire.Doc for Java

Category ID Description
New feature - Supports converting Word to OFD format.
Document document = new Document();
document.loadFromFile("input.docx");
document.saveToFile("output.ofd", FileFormat.OFD);
New feature SPIREDOC-6969 Supports setting the revision author.
Document doc = new Document();
doc.loadFromFile(inputFile);
doc.setTrackChanges(true);
TextRange range = doc.getLastParagraph().appendText("123413");
range.getInsertRevision().setAuthor("user");
doc.saveToFile(outputFile);
doc.dispose(); 
New feature SPIREDOC-6992 Supports setting "ignore formatting" when doing the comparison.
Document.compare(Document document, String author, CompareOptions options);
Document.compare(Document document, String author, Date date, CompareOptions options);
CompareOptions.setIgnoreFormatting(true); 
Bug SPIREDOC-6723 Fixes the issue that the content format was incorrect after doing the comparison.
Bug SPIREDOC-6738 Fixes the issue that the merged cells were split when converting word document to PDF.
Bug SPIREDOC-6752 Fixes the issue that the table border style was changed after inserting a word document.
Bug SPIREDOC-6768 Fixes the issue that the application threw "java.lang.StackOverflowError" when converting a word document to PDF.
Bug SPIREDOC-6790 Fixes the issue that the application threw "java.lang.IllegalStateException" when loading a word document.
Bug SPIREDOC-6825 Fixes the issue that the content format was incorrect when converting a word document to PDF.
Bug SPIREDOC-6867 Fixes the issue that the application threw "No have this FieldType" when loading a word document.
Bug SPIREDOC-6872 Fixes the issue that the content format was changed after repplacing a document.
Bug SPIREDOC-6878 Fixes the issue that the application was hanging when converting a word document to PDF.
Bug SPIREDOC-6903 Fixes the issue that the TOC field was updated failed.
Bug SPIREDOC-6904 Fixes the issue that the application threw "incomplete dynamic bit lengths tree" when loading a word document.
Bug SPIREDOC-6909 Fixes the issue that the margins were incorrect when copying a section of the merged document to a new document.
Bug SPIREDOC-6920 Fixes the issue that the content was overlapped when converting a word document to PDF.
Bug SPIREDOC-6931 Fixes the issue that the list text obtained being incorrect.
Bug SPIREDOC-6983 Fixes the issue that the content was incorrect when converting a word document to PDF.
Bug SPIREDOC-7010 Fixes the issue that the watermark text was displayed incorrectly when converting a word document to PDF.
Bug SPIREDOC-7028 Fixes the issue that the application threw "IllegalArgumentException" when converting a word document to PDF.
Bug SPIREDOC-7055 Fixes the issue that the content was incorrect after accepting Changes.
Bug SPIREDOC-5323 Fixes the issue that the returned value was incorrect when calling "hasChanges()"
Bug SPIREDOC-6876 Fixes the issue that the content format was incorrect when converting a word document to PDF
Bug SPIREDOC-6950 Fixes the issue that the content format was incorrect when converting a word document to PDF
Bug SPIREDOC-6984 Fixes the issue that the time field was not updated when saving .docx format file to .doc format.
Bug SPIREDOC-7001 Fixes the issue that the number of pages was changed when converting a word document to PDF.
Bug SPIREDOC-7060 Fixes the issue that the application threw "There is no more open element" after replacing the content of bookmarks.
Bug SPIREDOC-7013 Fixes the issue that the obtained bookmark name was incorrect.
Bug SPIREDOC-7028 Fixes the issue that the formulas garbled when converting a word document to PDF.
Bug SPIREDOC-7076 Fixes the issue that the application threw "Unknown char" when appending Html string.

Spire.PDF for Java

Category ID Description
New feature SPIREPDF-4781 Supports that the text of cell is not wrapped when converting PDF to Excel file
//The fourth parameter controls whether the text is wrapped
doc.getConvertOptions().setPdfToXlsxOptions(new XlsxLineLayoutOptions(false, false, false, false));
New feature - Supports converting PDF to linearized PDF.
PdfToLinearizedPdfConverter converter = new PdfToLinearizedPdfConverter(inputPath);
converter.toLinearizedPdf(OutputPath); 
Bug SPIREPDF-4760 Fixes the issue that the application threw an error "java.lang.NullPointerException" when copying page content
Bug SPIREPDF-4770 Fixes the issue that the application threw an error "java.lang.ClassCastException" when copying page content
Bug SPIREPDF-4771 Fixes the issue that the application threw an error "java.lang.NullPointerException" when converting to PDFA file
Bug SPIREPDF-4774 Fixes the issue that converting PDF to OFD stream failed
Bug SPIREPDF-4789 Fixes the issue that the image content was incorrect after compressing the images in PDF file
Bug SPIREPDF-4794 Fixes the issue that there was extra space on the right side of the converted OFD document page

Spire.Presentation for Java

Category ID Description
New feature SPIREPPT-1719 Supports adding math equations and checking whether shape contains math equations.
Presentation ppt = new Presentation();
ppt.loadFromFile("input.pptx");
String latexMathCode = "x^{2}+\\sqrt{x^{2}+1}=2";
IAutoShape shape = ppt.getSlides().get(0).getShapes().appendShape(ShapeType.RECTANGLE, new Rectangle2D.Float(30, 100, 400, 30));
shape.getTextFrame().getParagraphs().clear();

//Add math equation
ParagraphEx tp = shape.getTextFrame().getParagraphs().addParagraphFromLatexMathCode(latexMathCode);for (int i = 0; i<ppt.getSlides().get(0).getShapes().getCount(); i++)
{
    //Check whether shape contains math equations
    boolean containMathEquation = ((IAutoShape)ppt.getSlides().get(0).getShapes().get(i)).isContainMathEquation();
}
ppt.saveToFile("output.pptx", FileFormat.PPTX_2013);
ppt.dispose();
Bug SPIREPPT-1716 Fixes the issue that the settings for chart legend "isOverlay" property didn't make effect.
Bug SPIREPPT-1718 Fixes the issue that the isNoFill() and getAlignment() methods returned incorrect values.
Bug SPIREPPT-1725 SPIREPPT-1736
SPIREPPT-1749
Fixes the issue that the content was incorrect when converting PPT shape to image.
Bug SPIREPPT-1754 Fixes the issue that the animation effect was modified after copying a slide.
Bug SPIREPPT-1767 Fixes the issue that the content was wrong when converting PPT files to PDF in multi threadings.

Spire.XLS for Java

Category ID Description
New feature SPIREXLS-3568 Supports converting excel file to OFD.
Workbook workbook = new Workbook();
workbook.loadFromFile("input.xlsx");
workbook.saveToFile("output.ofd", FileFormat.OFD); 
New feature SPIREXLS-3571 Supports "Subtotal" function.
Workbook workbook = new Workbook();
workbook.loadFromFile(inputFile);
Worksheet sheet = workbook.getWorksheets().get(0);
//Select data range
CellRange range = sheet.getRange().get("A1:B18");
//Subtotal selected data
sheet.subtotal(range, 0, new int[] { 1 }, SubtotalTypes.Sum, true, false, true);
//Save to file.
workbook.saveToFile(outputFile, ExcelVersion.Version2010);
workbook.dispose(); 
Bug SPIREXLS-3413 Fixes the issue that the "Wrap text" didn't take effect after merging cells.
Bug SPIREXLS-3486
SPIREXLS-3545
Fixes the issue that the content format was incorrect when converting excel file to PDF.
Bug SPIREXLS-3564
SPIREXLS-3565
Fixes the issue that the application threw "Unknown char:" error when saving a chart as an image.
Bug SPIREXLS-3566 Fixes the issue that the effect of converting pdf was incorrect after setting "blackAndWhite" as "true".
Bug SPIREXLS-3567 Fixes the issue that the trend line was lost when saving chart as image.
Bug SPIREXLS-3569 Fixes the issue that the chart content format was incorrect when converting excel file to image.
Bug SPIREXLS-2736 Fixes the issue that the format was not correct when converting an excel to PDF
Bug SPIREXLS-3158 Fixes the issue that the obtained cell value of the date format was wrong
Bug SPIREXLS-3485 Fixes the issue that the checked "Align with page margins" item was missing