Spire.Office for Java 3.6.4现已正式发布。该版本有许多新功能,例如,Spire.XLS支持设置超链接类型及转换Excel到HTML,Spire.Doc改善了打印质量,Spire.PDF支持使用QT插件将HTML转换为PDF。除此之外,一些在加载、转换和操作Word、Excel、PPT和Presentation文档时出现的问题也得以成功解决。更多关于新功能和问题的细节参见下文。
获取Spire.Office for Java 3.6.4,请点击:https://www.e-iceblue.cn/Downloads/Spire-Office-JAVA.html
Spire.XLS for Java
新功能:
- 支持拷贝单元格时只保留公式值。
Worksheet sheet = workbook.getWorksheets().get(0);
CopyRangeOptions copyOptions = CopyRangeOptions.OnlyCopyFormulaValue;
sheet.copy(sheet.getCellRange("A6:E6"), sheet.getCellRange("A8:E8"), EnumSet.of(copyOptions));
workbook.saveToFile(filename,FileFormat.HTML)
hyperlink.setType(HyperLinkType.File);
问题修复:
- 修复了复制sheet时单元格名称丢失的问题。
- 修复了转换Excel到图片时抛出NullPointerException的问题。
- 修复了cellRange.hasMerged()方法返回的结果不正确的问题。
- 修复了创建的气泡图格式不正确的问题。
- 修复了根据数据透视表创建的图表格式不正确的问题。
- 修复了转换XLS到XML,程序抛"NullPointerException"的问题。
- 修复了转换Excel到PDF后,文本加粗样式不正确的问题。
- 修复了转换Excel到图片后,图表格式不正确的问题。
- 修复了排序后数据丢失的问题。
- 修复了转换Excel到图片,内容丢失的问题。
- 修复了在Centos上转换Excel到图片,程序抛 "Index is less than 0 or more than or equal to the list count"的问题。
- 修复了转换Excel到XML,结果文档打开提示文件损坏的问题。
- 修复了多线程并发转换Excel到PDF,程序抛"NullPointerException"的问题。
Spire.Doc for Java
新功能:
- 提升了打印质量
Document loDoc = new Document(inputFile);
PrinterJob loPrinterJob = PrinterJob.getPrinterJob();
PageFormat loPageFormat = loPrinterJob.defaultPage();
Paper loPaper = loPageFormat.getPaper();
//删除默认的打印页边距
loPaper.setImageableArea(0,0,loPageFormat.getWidth(),loPageFormat.getHeight());
//设置副本的数量
loPrinterJob.setCopies(1);
loPageFormat.setPaper(loPaper);
loPrinterJob.setPrintable(loDoc,loPageFormat);s
try {
loPrinterJob.print();
} catch (PrinterException e)
{
e.printStackTrace();
}
问题修复:
- 修复了提取公式值不正确的问题
- 修复了转换Word到PDF多出空白页的问题
- 修复了加载文档抛出异常Unknown format的问题
- 修复了加载保存文档时内容部分丢失的问题
- 修复了加载文档抛异常 “Attempted to read past the end of the stream” 的问题
- 修复了加载文档抛异常“NullPointerException”的问题
- 修复了使用MathML Code创建OfficeMath对象时抛出异常“Invalid data”
- 修复了转换Word到PDF抛异常“No have this value 115”
- 修复了更新目录抛“ClassCastException”的问题
- 修复了Word转PDF抛“KeyNotFoundException”的问题
- 修复了插入目录抛“IndexOutOfBoundsException”的问题
- 修复了加载文档抛“NullPointerException”的问题
- 修复了加载文档抛异常“Attempted to read past the end of the stream”的问题
- 修复了加载文档抛异常“OLE stream in not valid”的问题
- 修复了移除分节符时抛“ArrayIndexOutOfBoundsException”的问题
- 修复了加载文档抛“No have this Word97Color”的问题
- 修复了Word转PDF表格内容不正确的问题
- 修复了Word转PDF字符重叠的问题
- 修复了Word转PDF文本被截断的问题
- 修复了加载文档抛异常“No have this MathJustification”的问题
- 修复了加载文档抛异常“NullPointerException”的问题
- 修复了Word转PDF抛“NullPointerException”的问题
- 修复了移除分节符抛“ArrayOutOfBoundsException”的问题
- 修复了加载文档抛异常“No have this value 142”的问题
Spire.Presentation for Java
问题修复:
- 修复了更改图表数据后结果文档的图表数据访问不了的问题。
- 修复了获取表格字体大小失败的问题。
- 修复了转换SmartArt到图片,内容不正确的问题。
- 修复了转换箭头形状到图片,内容不完整的问题。
- 修复了转换PPT到image抛OutOfMemoryError的问题。
- 修复了转换PPT到image渐变色不正确的问题。
- 修复了转换PPT到image程序悬挂的问题。
Spire.PDF for Java
新功能:
- 支持使用QT插件将HTML转换为PDF。
String url = "https://www.baidu.com";
String fileName = "D:/output.pdf";
String pluginPath = "D:/Qt/plugins_64";
HtmlConverter.setPluginPath(pluginPath);
HtmlConverter.convert(url,fileName);
IOCR loIOCR=(image)->{
String extractedText = "";
//OCR API
//extractedText = ...
return extractedText;
};
PdfDocument.setExportTextOCRHandler(loIOCR);
PdfDocument pdf=new PdfDocument();
pdf.loadFromFile(inputPath);
String text = "";
for (PdfPageBase page : (Iterable) pdf.getPages()) {
text += page.extractText();
}
FileWriter sw = new FileWriter(outputPath);
sw.write(text);
sw.flush();
sw.close();
pdf.close();
String url = "https://freetsa.org/tsr";
signature.configureTimestamp(url,"user_name","password");
问题修复:
- 修复了签名时签名信息显示不正确的问题。
signature.removeShowConfigureText(SignatureConfigureText.Distinguished_Name);
- 修复了提取图片时抛“OutOfMemoryError”的问题。
- 修复了PDF转Word内容丢失的问题。
- 修复了提取文本时抛“NullPointerException”的问题。
- 修复了在CentOS上签名时抛异常“The request timed out”的问题。
- 修复了PdfImage使用BufferedImage传入图片时图片变暗的问题。
- 修复了PDF转图片抛“OutOfMemoryError”的问题。