Enhance Excel export functionality in backend and frontend; implement Excel file generation and update download logic for correct file extension
This commit is contained in:
@@ -34,7 +34,7 @@ class ExportController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Exportiert Daten als Excel
|
||||
* Exportiert Daten als Excel (.xlsx)
|
||||
*/
|
||||
async exportExcel(req, res) {
|
||||
try {
|
||||
@@ -47,11 +47,11 @@ class ExportController {
|
||||
});
|
||||
}
|
||||
|
||||
const excel = await ExportService.exportExcel(userId, startDate, endDate);
|
||||
const buffer = await ExportService.exportExcel(userId, startDate, endDate);
|
||||
|
||||
res.setHeader('Content-Type', 'text/csv; charset=utf-8');
|
||||
res.setHeader('Content-Disposition', `attachment; filename="zeiterfassung_${startDate}_${endDate}.csv"`);
|
||||
res.send(excel);
|
||||
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
res.setHeader('Content-Disposition', `attachment; filename="zeiterfassung_${startDate}_${endDate}.xlsx"`);
|
||||
res.send(buffer);
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Excel-Export:', error);
|
||||
res.status(500).json({
|
||||
|
||||
Reference in New Issue
Block a user