I am able to read the csv file in Microsoft excel, but when I try to save it, it gets saved as text as it's in tab delimited form and the changes made are lost.
WebUtils.download(response, datafetcher, form.getString("rep开发者_运维问答ortName") + ".xls",
"application/vnd.excel", hdr, "\t");
If I'm reading this right, you are relying on the fact that Excel will go ahead and load a CSV file that is called something.XLS, but when it's saved again it will maintain the CSV format and therefore lose all the formatting applied. As DwB says, Excel should warn about this with a fairly clear message unless that's been disabled.
I don't think there's a lot you can do here, other than some client education or rewriting your report to actually export a genuine XLS or XLSX file.
精彩评论