Generating excel file of extension .xlsx

41 views Asked by At

Using this :

HttpHeaders headers = new HttpHeaders();
headers.setContentLength(byteArray.length);
headers.setContentType(MediaType.parseMediaType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
headers.setCacheControl(CacheControl.noCache());
headers.add("Content-Disposition", "attachment; filename=yourFileName.xlsx");

When the file gets generated then it shows as *.xls. Ideally file should get generated as *.xlsx, but file name extension is *.xls.

Tried this:

headers.setContentType(MediaType.parseMediaType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));

But no luck.

0

There are 0 answers