Spire.Doc for Java 5.2.3已发布。该版本支持在段落中查找所有匹配的字符串,并增强了Word到PDF以及HTML到Word的转换功能。此外还修复了加载Word文件时程序抛出“Operation is not valid due to the current state of the object”等已知问题。详情请阅读以下内容:
新功能:
- 支持在段落中查找所有匹配的字符串。
Document document = new Document();
document.loadFromFile("Sample.docx");
Section s = document.getSections().get(0);
Paragraph para = s.getParagraphs().get(0);
//第一种方式
TextSelection[] textSelections = para.findAllString("The", false, true);
for (TextSelection selection : textSelections)
{
//高亮
selection.getAsOneRange().getCharacterFormat().setHighlightColor(new Color(255, 255, 0));
}
//第二种方式
Pattern c = Pattern.compile("The");
TextSelection[] textSelections = para.findAllPattern(c);
for (TextSelection selection : textSelections)
{
TextRange[] results = selection.getAsRange();
for (TextRange result : results)
{
//高亮
result.getCharacterFormat().setHighlightColor(Color.yellow);
}
}
问题修复:
- 修复了加载word文件时程序抛出“Operation is not valid due to the current state of the object”的问题。
- 修复了查找结果不正确的问题。
- 修复了word文件转PDF后内容格式不正确的问题。
- 修复了接受修订后表格内容格式不正确的问题。
- 修复了word文件转PDF后部分页面丢失的问题。
- 修复了程序在将word文件转换为PDF时抛出“OutOfMemoryError”的问题。
- 修复了word文件转PDF后部分文字重叠的问题。
- 修复了将 html 文件转换为 word 时程序抛出“IndexOutOfBoundsException”的问题。
- 修复了word文件转PDF后列表内容不正确的问题。
- 修复了接受修订后表格内容格式不正确的问题。
- 修复了word文件转PDF时无法生成PDF文件的问题。
- 修复了word文件转PDF后表格内容丢失的问题。
- 修复了加载word文件时应用程序抛出“NullPointerException”的问题。
- 修复了保存word文件时应用程序抛出“Namespace URI must not be null when prefix is not an empty string”的问题。
获取Spire.Doc for Java 5.2.3请点击: