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

版本3.0.0-beta3 填充Excel,模板中时间类型Date样式丢失 #2124

Closed
WENZIZZHENG opened this issue Oct 10, 2021 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@WENZIZZHENG
Copy link

WENZIZZHENG commented Oct 10, 2021

触发Bug的代码

       @Test
    public void simpleFill() {
        // 模板注意 用{} 来表示你要用的变量 如果本来就有"{","}" 特殊字符 用"\{","\}"代替
        String templateFileName =
            TestFileUtil.getPath() + "demo" + File.separator + "fill" + File.separator + "simple.xlsx";

        // 方案1 根据对象填充
        String fileName = TestFileUtil.getPath() + "simpleFill" + System.currentTimeMillis() + ".xlsx";
        // 这里 会填充到第一个sheet, 然后文件流会自动关闭
        FillData fillData = new FillData();
        fillData.setName("张三");
        fillData.setNumber(5.2);
        //时间
        fillData.setDate(new Date());
        EasyExcel.write(fileName).withTemplate(templateFileName).sheet().doFill(fillData);
    }

@Data
public class FillData {
    private String name;
    private double number;
    private Date date;
}

提示的异常或者没有达到的效果
image

@WENZIZZHENG WENZIZZHENG added the bug Something isn't working label Oct 10, 2021
@WENZIZZHENG WENZIZZHENG changed the title 版本3.0.0-beta3 填充Excel,时间类型Date样式丢失 版本3.0.0-beta3 填充Excel,模板中时间类型Date样式丢失 Oct 10, 2021
@zhuangjiaju
Copy link
Collaborator

已经在 3.0.1中修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants