Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output CSV with multiple header rows having first cell as rowspan #1761

Open
ptijul opened this issue Oct 15, 2020 · 0 comments
Open

Output CSV with multiple header rows having first cell as rowspan #1761

ptijul opened this issue Oct 15, 2020 · 0 comments

Comments

@ptijul
Copy link

ptijul commented Oct 15, 2020

Hello @Mottie,

I have a bug in the export CSV with a table with multiple header rows AND first one as rowspan.
From your demo - 2nd one with rowspan you can reproduce the issue by following config below:

output_headerRows: true,
output_formatContent: function (config, widgetOptions, data) {
   console.log(config, widgetOptions, data);
   if (insertBOM) {
            console.warn('BOM');
            BOM = "\uFEFF"; // insert BOM UTF-8 to force Excel encoding UTF-8. Without it, the accented characters are not properly shown in Excel but in Notepad++ it does.
            insertBOM = false;
            return BOM + "**BEGIN**" + data.content.replace(/&/g, '&')
   }

   return data.content;
}

The console.log will prompt (note where the "BEGIN text is prompted that represent the BOM i'm inserting):

;values;values;values
**BEGIN**line;value1;value2;value3
1;1.1;1.2;1.3

wheras I assume to have (note where the "BEGIN text is prompted):

**BEGIN**;values;values;values
line;value1;value2;value3
1;1.1;1.2;1.3

If I change the thead of your demo (copied on my side) and don't use rowspan at first header row, it's completly fine ! The output_formatContent function will output data in the right order (my BEGIN will be prompted first so BOM will also do).

Note, even if in the doc it says "Note including a BOM in the output_encoding option is no longer required!" I'm not able to do it without the BOM even if I let the default encoding option (UTF8) or put the BOM in the output_encoding as per your suggestion in doc // With BOM : 'data:text/csv;charset=utf8,%EF%BB%BF' this has completly no effect to me.
That's why I'm inserted BOM at first part of data which was working until we decided to include the first header row as well (turned output_headerRows to true)

I'm using version 2.31.3 (latest).

Many thanks in advance for your time and for any help !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant