java - 我在java中使用jopendocument解析ods文件合并单元格有冲突吗?
问题描述
当我尝试使用 java 代码中的 jopentextformat 解析 ods 表时,会抛出一个异常,如下所示。请注意,第一个合并单元格的行和列获取合并单元格的第二个单元格引发以下错误的数据。请帮我解决一下这个。我将每个单元格转换为字符串,以便我可以比较和解析数据。在获取合并单元格(合并单元格的第二个单元格)时,会发生这种情况。
public String getCellValueAt(int rowIndex, int columnIndex) {
Sheet s;
String cellVal;
if (s.getCellAt(columnIndex, rowIndex).getValue() != null) {
cellVal = s.getCellAt(columnIndex, rowIndex).getValue().toString();
if(cellVal != null && cellVal != "") {
cellVal = cellVal.trim();
}
}
else {
cellVal = " ";
}
return cellVal;
}
//下面给出的异常
java.lang.IllegalArgumentException: invalid cell <table:covered-table-cell xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" />
at org.jopendocument.dom.spreadsheet.Row.getValidCellAt(Unknown Source) ~[jOpenDocument-1.3.jar:2.6.9]
at org.jopendocument.dom.spreadsheet.Row.getMutableCellAt(Unknown Source) ~[jOpenDocument-1.3.jar:2.6.9]
at org.jopendocument.dom.spreadsheet.Table.getCellAt(Unknown Source) ~[jOpenDocument-1.3.jar:2.6.9]
解决方案
推荐阅读
- java - 仅当同一对象作为方法中的参数传递时才锁定
- .net-core - Azure DevOps 管道缺少 ComponentSpace 许可证
- r - df[df>0] 在 R 和 Python 中有不同的输出
- elasticsearch - 使用 Elasticsearch Java API 从 Completion Suggester 中检索文档
- git - 接收失败:连接已重置 git
- sharepoint - 使用 Graph Api 创建团队时,无法访问 Microsoft Teams 频道电子邮件地址、SharePoint 和文件
- flutter - 如何从 GraphQL 生成 Dart - graphql 到 dart 生成器
- c# - 调用 httpClient.GetAsync() 时发送任何数据失败,有时会捕获 TaskCanceledException
- javascript - 当用户未登录odoo 13时,JS不会触发
- node.js - Jest - 测试证书验证