This repository was archived by the owner on Sep 4, 2025. It is now read-only.
[fix]修复 inlineStr 类型可能存在的数据读取错误 #3861
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
关联issue:
#3860
#3823
修复原因:
<c>标签且标记为inlineStr类型的数据类别下,<v>标签为无效且错误数据,WPS和office都会默认过滤该标签,同时进行纠错;<c>标签且标记为inlineStr下的<v>标签。代码逻辑:
CellDataTypeEnum的str匹配至ERRORstr标签是正常的String标签,对于xml文件来说,可以存放大部分的标签数据。原来的str匹配的是DIRECT_STRING,就会导致诸多规则不匹配的问题。修改后,因为取值时,
ERROR和DIRECT_STRING的取值规则都是一致的,因此可以直接兼容。在
XlsxRowHandler的public void characters(char[] ch, int start, int length)函数中,对inlinStr进行判断,如果此时数据结构为DIRECT_STRING,并且标签为<v>的时候,不进行解析,直接跳过。