Spire.Office for Java 9.4.0 is released

2024-04-28 01:32:04

We are excited to announce the release of Spire.Office for Java 9.4.0. In this version, Spire.Doc for Java supports loading, manipulating, and converting Markdown documents; Spire.PDF for Java supports getting the keyword font names and sizes; Spire.XLS for Java adds a method to convert a worksheet to an SVG document; Spire.Barcode for Java supports adding pictures to the center of QR code. Besides, a lot of known issues are fixed successfully in this version. More details are listed below.

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

Here is a list of changes made in this release

Spire.Doc for Java

Category ID Description
New feature SPIREDOC-10091 Supports loading and operating MarkDown documents, or converting word documents to MarkDown.
Document doc = new Document();
//load .md file
doc.loadFromFile("input.md");
//save to .md file
doc.saveToFile("output.md", com.spire.doc.FileFormat.Markdown);
//save to .docx file
//doc.saveToFile("output.docx", com.spire.doc.FileFormat.Docx);
//save to .doc file
//doc.saveToFile("output.doc", com.spire.doc.FileFormat.Doc);
//save to .pdf file
//doc.saveToFile("output.pdf", com.spire.doc.FileFormat.PDF);
doc.close();

Document doc = new Document();
//load .docx file
doc.loadFromFile("input.docx");
//load .doc file
//doc.loadFromFile("input.doc");
//save to .md file
doc.saveToFile("output.md", com.spire.doc.FileFormat.Markdown);
doc.close();
Bug SPIREDOC-9801 Fixes the issue that the content format was inconsistent after converting Word to PDF.
Bug SPIREDOC-10038 Fixes the issue that the rest content of the document was changed after replacing the content of bookmarks.
Bug SPIREDOC-10073 Optimizes the document size of Word to PDF conversion results.
Bug SPIREDOC-10183 Fixes the issue that the result document of comparison reported an error when opening.
Bug SPIREDOC-10237 Fixes the issue that the content was not formatted correctly after converting Word to HTML.
Bug SPIREDOC-10283 Fixes the issue that it reported "Cannot found font insatlled on the system" error when converting Word to PDF on linux environment without any fonts installed.
Bug SPIREDOC-10292 Fixes the issue that the number of pages was incorrect after converting Word to SVG.
Bug SPIREDOC-10364 Fixes the issue that it reported "Error loading file: Unsupported file format" error when loading ODT file.
Bug SPIREDOC-10369 Fixes the issue that the generated Word documents could not be opened by WeChat on Apple mobile devices.
Bug SPIREDOC-10387 Optimizes FixedLayoutLine.getRectangle() method to get its height and width, i.e. FixedLayoutLine.getRectangle().width and FixedLayoutLine.getRectangle().height.

Spire.PDF for Java

Category ID Description
New feature SPIREPDF-6243
SPIREPDF-6638
Supports getting the keyword font names and sizes.
PdfDocument pdf = new PdfDocument();
pdf.loadFromFile(inputFile);
PdfPageBase page = pdf.getPages().get(0);
PdfTextFinder finds = new PdfTextFinder(page);
finds.getOptions().setTextFindParameter(EnumSet.of(TextFindParameter.IgnoreCase));
List<PdfTextFragment> result = finds.findAllText(page);
StringBuilder str = new StringBuilder();
for (PdfTextFragment find : result)
{
	str.append("FontName:"+find.getTextStates()[0].getFontName());
	str.append("FontSize:"+find.getTextStates()[0].getFontSize());
	str.append("FontFamily:"+find.getTextStates()[0].getFontFamily());
	str.append("Bold:"+find.getTextStates()[0].isBold());
	str.append("Italic:"+find.getTextStates()[0].isItalic());
	str.append("ForegroundColor:"+find.getTextStates()[0].getForegroundColor());
}
New feature SPIREPDF-6560 The PdfTextReplacer class supports matching through regular expressions.
PdfDocument doc = new PdfDocument();
doc.loadFromFile("input.pdf");
PdfTextReplaceOptions textReplaceOptions = new PdfTextReplaceOptions();
textReplaceOptions.setReplaceType(EnumSet.of(ReplaceActionType.Regex));
PdfPageBase page = doc.getPages().get(0);
PdfTextReplacer textReplacer = new PdfTextReplacer(page);
textReplacer.setOptions(textReplaceOptions);
String regularExpression = "\\bS\\w*L\\b";
textReplacer.replaceAllText(regularExpression, "NEW");
doc.saveToFile("output.pdf");
doc.dispose();  
Bug SPIREPDF-6330 Fixes the issue that the converted PDFA2B file did not pass validation.

Spire.XLS for Java

Category ID Description
New feature SPIREXLS-5111 Adds a new method for converting Excel worksheets to SVG documents, with support for returning SVG dimensions.
Workbook workbook = new Workbook();
workbook.loadFromFile("1.xlsx");
Worksheet sheet = workbook.getWorksheets().get(0);
FileOutputStream stream = new FileOutputStream(outputFile);
Dimension dimension = sheet.toSVGStream(stream, sheet.getFirstRow(), sheet.getFirstColumn(), sheet.getLastRow(), sheet.getLastColumn());
double Height = dimension.getHeight();
double Width = dimension.getWidth();
Bug SPIREXLS-5077 Fixes the issue that the text positions were incorrect when converting an Excel document to a PDF document.
Bug SPIREXLS-5130 Fixes the issue that the hyperlinks were lost when converting an Excel document to an HTML document.
Bug SPIREXLS-5140 Fixes the issue that the right margin increased when converting an Excel document to a PDF document in a Japanese language environment.
Bug SPIREXLS-5150 Fixes the issue that the content was lost when converting an Excel document to a PDF document.
Bug SPIREXLS-5178 Fixes the issue that adding custom filters did not take effect.
Bug SPIREXLS-5179 Fixes the issue that the image scale was distorted when converting an Excel document to a PDF document.
Bug SPIREXLS-5180 Fixes the issue that the program hangs indefinitely when converting an HTML document to an Excel document.
Bug SPIREXLS-5184 Fixes the issue that the tables were incomplete when converting an Excel document to an HTML document.

Spire.Presentation for Java

Category ID Description
Bug SPIREPPT-2450 Fixes the issue that the CPU usage reached 100 percent and memory overflowed after the end of the task in the thread pool of converting a large number of documents under multithreading.

Spire.Barcode for Java

Category ID Description
New feature - The method for applying a license has been changed to com.spire.barcode.license.LicenseProvider.setLicenseKey(key).
New feature SPIREBARCODE-244 Supports adding pictures to the center of QR code.
BarcodeSettings barCodeSetting = new BarcodeSettings();
BufferedImage image = ImageIO.read(new File("Image/1.png"));
barCodeSetting.setQRCodeLogoImage(image);
Bug SPIREBARCODE-243 Fixes the issue that barcode recognition failed in vertical orientation.