Spire.Office for Java 4.4.6 已发布。本次版本更新带来了一系列新的功能,比如: Spire.XLS for Java支持添加删除数字签名并新增 setCustomPaperSize 方法以自定义纸张大小;Spire.PDF for Java查找换行文本时,支持返回所有的矩形区域信息并新增移除 JavaScript 脚本的方法;Spire.Presentation for Java支持表格的分布行和分布列的功能等等。此外,该版本还修复了大量问题。详情请阅读以下内容。
获取Spire.Office for Java 4.4.6请点击:https://www.e-iceblue.cn/Downloads/Spire-Office-JAVA.html
Spire.XLS for Java
新功能:
- 支持了加载包含数学公式的excel文档和保存到其他格式(例如,PDF,图片,SVG, XPS等)
- 支持添加/删除数字签名
Workbook workbook=new Workbook();
workbook.loadFromFile("C:/sample.xlsx");
CertificateAndPrivateKey cap = new CertificateAndPrivateKey("C:/Test1.pfx","e-iceblue");
workbook.addDigitalSignature(cap, "e-iceblue",new Date());
String result="C:/result.xlsx";
workbook.saveToFile(result,ExcelVersion.Version2013);
Workbook workbook2=new Workbook();
workbook2.loadFromFile(result);
workbook2.removeAllDigitalSignatures();
String result2="C:/result2.xlsx";
workbook2.saveToFile(result2,ExcelVersion.Version2013);
workbook.getWorksheets().get(0).getPageSetup().setCustomPaperSize(100, 100);
问题修复:
- 修复了创建条件日期格式时颜色更新不正确的问题
- 修复了隐藏空白行时程序抛异常“java.lang.NullPointerException”的问题
- 修复了Excel转HTML内容不正确的问题
- 修复了XLSX转XLSM数据被隐藏的问题
Spire.PDF for Java
新功能:
- 查找换行文本时,支持返回所有的矩形区域信息
PdfDocument doc = new PdfDocument(); doc.loadFromFile(inputFile);
FileWriter fileWriter = new FileWriter(outputFile, true);
int index=0;
for (PdfPageBase page : (Iterable) doc.getPages())
{
index++; PdfTextFind[] results = page.findText("findtext", EnumSet.of(TextFindParameter.CrossLine)).getFinds();
for (PdfTextFind text : results)
{
text.applyHighLight(); List bounds = text.getTextBounds();
String context="";
for (Rectangle2D rectangle2D:bounds)
{
context +="current "+index+" page;content:"+text.getSearchText()+ ";X:="+rectangle2D.getX()+","+"Y:="+rectangle2D.getY()+","+ "Width:="+rectangle2D.getWidth()+","+"height:="+rectangle2D.getHeight()+"\r\n";
} System.out.println(context); fileWriter.write(context); fileWriter.flush();
}
} fileWriter.close(); doc.saveToFile(outputPdf);
PdfDocument pdf = new PdfDocument();
pdf.loadFromFile(input);
pdf.removeDocumentJavaScript();
pdf.saveToFile(output, FileFormat.PDF);
问题修复:
- 修复了提取的文本内容不正确的问题
- 修复了循环给文档添加水印时,消耗内存大的问题
- 修复了转换PDF到Word内容重叠的问题
- 修复了转换PDF到PDF/A-3B抛异常(Value cannot be null)的问题
- 修复了添加水印,程序抛异常的问题
- 修复了转换PDF到PDFA1A,在线验证不通过的问题
- 修复了转换PDF到PDF/A格式内容丢失的问题
Spire.Presentation for Java
优化:
- 优化了插入图片耗时长的问题
新功能:
- 支持表格的分布行和分布列的功能
ISlide slide = presentation.getSlides().get(0);
ITable table = (ITable) slide.getShapes().get(0);
table.distributeRows(0,3);
table.distributeColumns(0,2);
问题修复:
- 修复了PPT转PDF内存消耗太大的问题
- 优化了转换PPTX到PDF的时间
- 修复了在Centos系统上提取图片抛异常“ArrayIndexOutOfBoundsException”的问题
- 修复了加载文档抛异常“Property not found”的问题
- 修复了转换PPT到PDF内容不正确的问题
- 修复了获取PPT文件中Chart数据,抛异常“ArrayIndexOutOfBoundsException”的问题