diff --git a/src/app/services/download.service.ts b/src/app/services/download.service.ts index 0c13604..7ff1521 100644 --- a/src/app/services/download.service.ts +++ b/src/app/services/download.service.ts @@ -24,13 +24,19 @@ export class DownloadService { const newRow = columnInfo.map((column) => { let cellData = row[column.dataPath]; if (Array.isArray(cellData)) { - cellData = cellData.join(', '); + cellData = cellData.join('", "'); } else if (column.type === 'NumRange') { - cellData = (row[column.dataPath + ".min"] || '') + " bis " + (row[column.dataPath + ".max"] || ''); + cellData = + (row[column.dataPath + '.min'] || '') + + ' bis ' + + (row[column.dataPath + '.max'] || ''); } else if (column.type === 'DateRange') { - cellData = (row[column.dataPath + ".from"] || '') + " bis " + (row[column.dataPath + ".to"] || ''); + cellData = + (row[column.dataPath + '.from'] || '') + + ' bis ' + + (row[column.dataPath + '.to'] || ''); } - return JSON.stringify(cellData || ''); + return '"' + (cellData ?? '').toString().replace(/"/g, "''") + '"'; }); csvData.push(newRow.join(this.csvChar)); }