Spire.Presentation for Java 9.8.3 support setting format when replacing text

2024-08-30 07:21:49

We are pleased to announce the release of Spire.Presentation for Java 9.8.3. This version provides a new method to set format when replacing text, and also fixes some known issues occurred when loading PowerPoint files, adding formulas in table cells, and adding LatexMath. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREPPT-2579 Provides the ReplaceAndFormatText(String matchedString, String newValue, PortionFormatEx format) method to support setting format when replacing text.
Presentation ppt = new Presentation();
// Load a PowerPoint presentation from the specified file.
ppt.loadFromFile(inputFile);
// Create a new object to store the default text range formatting properties.
PortionFormatEx format = new PortionFormatEx();
// Set the IsBold property of the text range formatting to true, making the text bold.
format.isBold(TriState.TRUE);
// Set the FillType property of the text range fill to Solid, indicating a solid fill color.
format.getFill().setFillType(FillFormatType.SOLID);
// Set the Color property of the solid fill color to red.
format.getFill().getSolidColor().setColor(Color.red);
// Set the FontHeight property of the text range formatting to 25, indicating the font size.
format.setFontHeight(25);
format.isBold(TriState.TRUE);

// Replace all occurrences of the text "Spire.Presentation for .NET" with "Spire.PPT" and apply the specified formatting.
ppt.ReplaceAndFormatText("Spire.Presentation for .NET", "Spire.PPT", format);

// Save the modified presentation to the specified output file in the PPTX format compatible with PowerPoint 2016.
ppt.saveToFile(outputFile, FileFormat.PPTX_2016);
// Dispose of the Presentation object to free up resources
ppt.dispose();
Bug SPIREPPT-2544 Fixes the issue that the content did not fit automatically after changing the page orientation.
Bug SPIREPPT-2562 Fixes the issue that the formulas were incorrect when adding LatexMath.
Bug SPIREPPT-2577 Fixes the issue where Chinese characters in formula were displayed as "x".
Bug SPIREPPT-2589 Fixes the issue that the application threw the exception "java.lang.ClassCastException" when adding formulas in table cells.
Bug SPIREPPT-2593 Fixes the issue that the application threw the exception "OutOfMemory" when loading PowerPoint files.
Click the link below to download Spire.Presentation for Java 9.8.3: