Тёмный

74 - Spring Boot : How to download Microsoft Excel file using Spring Boot Rest API? | IOUtils 

Almighty Java
Подписаться 11 тыс.
Просмотров 4,8 тыс.
50% 1

#restapi #springboot #excel #microsoft #msexcel
@GetMapping("/download")
public ResponseEntity download() {
String fileName = "/Book1.xlsx";
InputStream is = this.getClass().getResourceAsStream(fileName);
try {
return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION, "attachment; fileName=" + fileName) .contentType(MediaType.parseMediaType("application/vnd.ms-excel")).body(IOUtils.toByteArray(is));
} catch (IOException e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
Please Support - www.buymeacoffee.com/almighty...

Опубликовано:

 

9 сен 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1   
@shamsiddu9286
@shamsiddu9286 Год назад
How can I save excel inside project resources
Далее
Викторина от ПАПЫ 🆘 | WICSUR #shorts
00:56
Spring Security JPA Authentication in Spring Boot
40:04
Why The Windows Phone Failed
24:08
Просмотров 178 тыс.
File Upload and Download with Spring Boot - REST API
29:04
How to read Excel files in C#
8:44
Просмотров 40 тыс.