Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

百分比解析问题 #240

Open
yingdawang opened this issue Apr 22, 2022 · 3 comments
Open

百分比解析问题 #240

yingdawang opened this issue Apr 22, 2022 · 3 comments

Comments

@yingdawang
Copy link

hi,在解析百分比格式时发现这样的一个问题,0.0X%会识别出现错误。
如图
image
这图中三个单元格不能正确的识别

@wangguanquan
Copy link
Owner

接收对象是double吗?是出现精度丢失还是其它问题?可以使用BigDecimal或者String接收,然后再处理小数点后4位就行。

测试代码

    public static class O {
        @ExcelColumn("名称")
        private String code;
        @ExcelColumn("double1")
        private BigDecimal d;

        @Override
        public String toString() {
            return code + ": " + d.setScale(4, BigDecimal.ROUND_HALF_UP);
        }
    }

@wangguanquan
Copy link
Owner

并且我使用double接收也没有发现问题,分别输出9.0E-4,4.0E-4,6.0E-4

@yingdawang
Copy link
Author

好的,谢谢,我在看下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants