Spire.Presentation for Java 9.8.3 已发布。该版本支持在替换文本时设置样式,并修复了一些在加载 PPT 文件,在表格单元格中添加公式,以及添加 Latex 公式时出现的问题。详情请查看以下内容。
新功能:
- 提供了 ReplaceAndFormatText(String matchedString, String newValue, PortionFormatEx format) 方法,支持在替换文本时设置样式。
Presentation ppt = new Presentation();
// 加载指定 PowerPoint 文档
ppt.loadFromFile(inputFile);
// 创建一个新对象,用于存储默认文本范围格式属性
PortionFormatEx format = new PortionFormatEx();
// 将文本范围格式的 IsBold 属性设置为 true 来加粗文本
format.isBold(TriState.TRUE);
// 将文本区域填充的 FillType 属性设置为 SOLID,表示纯色填充
format.getFill().setFillType(FillFormatType.SOLID);
// 将纯色填充的颜色属性设置为红色
format.getFill().getSolidColor().setColor(Color.red);
// 将文本范围格式的 FontHeight 属性设置为 25,表示字体大小
format.setFontHeight(25);
format.isBold(TriState.TRUE);
// 将所有出现的 "Spire.Presentation for .NET" 文本替换为 "Spire.PPT",并应用指定格式
ppt.ReplaceAndFormatText("Spire.Presentation for .NET", "Spire.PPT", format);
// 保存修改后的 PowerPoint 文档,并释放资源
ppt.saveToFile(outputFile, FileFormat.PPTX_2016);
ppt.dispose();
问题修复:
- 修复了修改页面方向后,内容没有自适应的问题。
- 修复了添加 Latex 公式,公式不正确的问题。
- 修复了公式中含中文,结果显示为 "x" 的问题。
- 修复了在表格单元格中添加公式,程序抛 "java.lang.ClassCastException" 报错的问题。
- 修复了加载 PPT 文件,程序抛 "OutOfMemory" 异常的问题。
获取 Spire.Presentation for Java 9.8.3 请点击:
https://www.e-iceblue.cn/Downloads/Spire-Presentation-JAVA.html