It is very strange that when other people do excel-related things, scientific notation appears, and scientific notation needs to be removed, but this time I need to convert the exported value in Excel to scientific notation for saving: Excel is as follows: these
two
columns The exported object needs to be set to String type:
@Excel(name = "p")
private String pvalue;
@Excel(name = "d")
private String fdr;
responseList is the collection object to be exported, traverse the collection, and convert the two columns in scientific notation:
the code is as follows:
//获取String类型的值
String pvalue = x.getPvalue();
//转换为BigDecimal对象
BigDecimal bd = new BigDecimal(pvalue);
//String.format转换为科学计数法
x.setPvalue(String.format("%E",bd));
Export results:
Click here to verify that there is no problem:
Learn a trick here: When postman sends a download request, you can convert the response into a file stream and save it: