fix excel version

This commit is contained in:
dalia.florinda
2026-01-22 11:43:49 +01:00
parent c6e29d158a
commit 6a26794c86

View File

@@ -647,13 +647,13 @@ export default {
const cells = row.querySelectorAll('th, td');
const rowData = Array.from(cells).map((cell) => {
let text = cell.textContent.trim();
// Escape quotes and wrap in quotes if contains comma
if (text.includes(',') || text.includes('"') || text.includes('\n')) {
// Escape quotes and wrap in quotes if contains semicolon, quotes or newlines
if (text.includes(';') || text.includes('"') || text.includes('\n')) {
text = '"' + text.replace(/"/g, '""') + '"';
}
return text;
});
csv += rowData.join(',') + '\n';
csv += rowData.join(';') + '\n';
});
// Add UTF-8 BOM for proper character encoding