Page 1 of 1

Keep Subtitle in .XLS Download

Posted: Mon Jun 17, 2019 2:00 pm
by dcothran
My charts have subtitles, and when I download an image, the subtitle is included in the download. However, when I download as a .XLS file, the subtitle disappears. The subtitle contains critical information, so I do not want it to disappear.

How can I retain the subtitle in a .XLS download?

Re: Keep Subtitle in .XLS Download

Posted: Tue Jun 18, 2019 7:32 am
by rafalS
Hi dcothran,

Welcome to our forum and thanks for contacting us.

I wrapped a method responsible for table generating and it's generating both title and subtitle now.
But, when I open exported .XLS file in Excel, the subtitle isn't nicely centered like the title. I think it's a limitation of excel or .XLS format that allows having only one header nicely styled, but I'm just guessing.

Here is an example for you: https://jsfiddle.net/BlackLabel/vtyeqb0j

Take a look at it and let me know what do you think or you have any further questions.

Best regards!

Re: Keep Subtitle in .XLS Download

Posted: Fri Jul 05, 2019 9:41 pm
by dcothran
Thanks, this is working, except the subtitle is currently the first row and the title is second, which should be reversed. But still a big improvement. Will any of this code be incorporated into the exporting.js file?

Re: Keep Subtitle in .XLS Download

Posted: Mon Jul 08, 2019 7:41 am
by rafalS
dcothran,

You can simply correct it in the code or you can swap subtitle with title in your chart options. I had a reason why I left it this way, but, to be honest, I don't remember why now... ;)

We don't have plans for adding this functionality to the core right now, but you can create a ticket on our UserVoice channel here: https://highcharts.uservoice.com
We will keep it noticed and implement as soon as it gets some more votes.

Best regards!

Re: Keep Subtitle in .XLS Download

Posted: Mon Jul 08, 2019 1:45 pm
by dcothran
Thanks for that link, Rafal! However, for switching the order of the title and subtitle, this is a little more tricky for me, as I am using software that generates both of these options for me, and there are special features on the title field that I need. Is there any adjustment to the code you sent that I could make to switch the order? I was reading through it, but I didn't see anywhere that this could be done, but I'm also not much of a JS dev.

Re: Keep Subtitle in .XLS Download

Posted: Mon Jul 08, 2019 1:57 pm
by rafalS
Sure, here you go: https://jsfiddle.net/BlackLabel/rn4txebf

I just swapped title with subtitle here:

Code: Select all

// Add table caption
    if (options.exporting.tableCaption !== false) {
      html += '<caption class="highcharts-table-caption">' + H.pick(
        options.exporting.tableCaption,
        (
          options.subtitle.text ?
          htmlencode(options.subtitle.text) :
          'Chart'
        )
      ) + '</caption>';
      html += '<caption class="highcharts-table-caption">' + H.pick(
        options.exporting.tableCaption,
        (
          options.title.text ?
          htmlencode(options.title.text) :
          'Chart'
        )
      ) + '</caption>';
    }

Regards.

Re: Keep Subtitle in .XLS Download

Posted: Mon Jul 08, 2019 2:15 pm
by dcothran
Perfect--thank you!