Export to Excel: why is it empty?

Export to Excel: why is it empty?

les_stocktonles_stockton Posts: 9Questions: 2Answers: 0

Why is my document empty, when I export to Excel from a table?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,880Questions: 1Answers: 10,139 Site admin

    Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.

    Information on how to create a test page, if you can't provide a link to your own page can be found here.

    Thanks,
    Allan

  • les_stocktonles_stockton Posts: 9Questions: 2Answers: 0

    Ok. here's a unstyled sample of what I'm trying to do. The export to Excel doesn't even work at this point, but the csv and the print do.
    What am I doing wrong?

    https://codepen.io/les_stockton/pen/vGdbVM

  • allanallan Posts: 61,880Questions: 1Answers: 10,139 Site admin

    Ah - you are using the Flash buttons. I think unfortunately, that is a bug - Buttons is referring to an old version of the SWF file.

    Could you try the following immediately before you initialise the DataTable (I couldn't see it in the pen):

    $.fn.dataTable.Buttons.swfPath = '//cdn.datatables.net/buttons/1.1.2/swf/flashExport.swf';
    

    Allan

  • les_stocktonles_stockton Posts: 9Questions: 2Answers: 0

    I don't have to use the flash buttons. In fact, I would prefer not to.

  • allanallan Posts: 61,880Questions: 1Answers: 10,139 Site admin

    Use the HTML5 buttons in that case. Don't include buttons.flash.js and do include buttons.html5.js.

    Allan

  • les_stocktonles_stockton Posts: 9Questions: 2Answers: 0

    I'll try again, but the last time I didn't include the flash, the buttons disappeared.
    I am including the html5 js.
    I'll mess around with it some more.

  • allanallan Posts: 61,880Questions: 1Answers: 10,139 Site admin
    Answer ✓

    You need to include the JSZip file if you want to use the Excel output. The DataTables downloader is the best way of making sure any dependencies are loaded.

    Allan

This discussion has been closed.