explicitly set mimetype for csv export
This commit is contained in:
parent
1b2258a4e5
commit
da722dd518
@ -154,7 +154,7 @@ export class CsvExportService {
|
||||
})
|
||||
.join(lineSeparator);
|
||||
|
||||
this.exporter.saveFile(csvContentAsString, filename);
|
||||
this.exporter.saveFile(csvContentAsString, filename, 'text/csv');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -14,9 +14,14 @@ export class FileExportService {
|
||||
* Saves a file
|
||||
* @param file
|
||||
* @param filename
|
||||
* @param mimeType an optional mime type
|
||||
*/
|
||||
public saveFile(file: BlobPart, filename: string): void {
|
||||
const blob = new Blob([file]);
|
||||
public saveFile(file: BlobPart, filename: string, mimeType?: string): void {
|
||||
const options: BlobPropertyBag = {};
|
||||
if (mimeType) {
|
||||
options.type = mimeType;
|
||||
}
|
||||
const blob = new Blob([file], options);
|
||||
saveAs(blob, filename, { autoBOM: true });
|
||||
// autoBOM = automatic byte-order-mark
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ export class AgendaImportListComponent extends BaseImportListComponent<ViewCreat
|
||||
'Break,,0:10,,internal',
|
||||
'Demo 2,Demo text 2,1:30,,hidden'
|
||||
];
|
||||
this.exporter.saveFile(rows.join('\n'), this.translate.instant('Topic example') + '.csv');
|
||||
this.exporter.saveFile(rows.join('\n'), this.translate.instant('Topic example') + '.csv', 'text/csv');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,6 +75,6 @@ export class MotionCsvExportService {
|
||||
'B1,Title 2,Text 2,Reason 2,Submitter B, Category B,, Block A',
|
||||
',Title 3, Text 3,,,,,'
|
||||
];
|
||||
this.fileExport.saveFile(rows.join('\n'), this.translate.instant('motions-example') + '.csv');
|
||||
this.fileExport.saveFile(rows.join('\n'), this.translate.instant('motions-example') + '.csv', 'text/csv');
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,8 @@ export class StatuteCsvExportService {
|
||||
];
|
||||
this.fileExport.saveFile(
|
||||
rows.join('\n'),
|
||||
`${this.translate.instant('Statutes')} - ${this.translate.instant('example')}.csv`
|
||||
`${this.translate.instant('Statutes')} - ${this.translate.instant('example')}.csv`,
|
||||
'text/csv'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ export class UserImportListComponent extends BaseImportListComponent<ViewUser> {
|
||||
',Fred,Bloggs,London,,,,,,,,',
|
||||
',,Executive Board,,,,,,,1,,'
|
||||
];
|
||||
this.exporter.saveFile(rows.join('\n'), this.translate.instant('participants-example') + '.csv');
|
||||
this.exporter.saveFile(rows.join('\n'), this.translate.instant('participants-example') + '.csv', 'text/csv');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user