Issues to Export data to Excel

Issues to Export data to Excel

jwsmarjwsmar Posts: 2Questions: 1Answers: 0
edited February 17 in Free community support

Hello everybody!

I'm newbie in datatables API and I'm found some issues to export data for Excel. The fist issue is that I need to whart text in same cell. for this topic I found a alternative solution passing the information as formula. The problem is I need to replace = to = to excel understand that I'm working with formulas and a I need to active the option in excel to wrap text in excel.

I tried to look in others topics but I didn't found a solution...

Below you can check my javascript code:

 $(document).ready(function () {
        $('#datatable').DataTable({
            keys: true,
            dom: 'Bfrtip',
            lengthMenu: [
            [10, 25, 50, -1],
            ['10 rows', '25 rows', '50 rows', 'Show all']
            ],
            buttons: ['pageLength',
                {
                    extend: 'excelHtml5',
                    autoFilter: true,
                    text: 'Export to Excel',
                    title: 'Pré Configurador',
                    exportOptions: {
                        format: {
                            body: function (data, row, column, node) {
                                //if it is html, return the text of the html instead of html
                                data = "=\"" + data.replace(/<br>/g, "\"&CARACTUNICODE(10)&\"") + "\""
                                data = remove_tags(data);
                                $(this).attr('s', '55');
                                return data;
                            }
                        }
                    }
                }
            ]
        });
        });

Could you please helo me?

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 8,085Questions: 0Answers: 1,357
    Answer ✓

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

  • jwsmarjwsmar Posts: 2Questions: 1Answers: 0

    Hello Colin,

    Thanks a lot for your help. I found a solution for my issue based on the thread indicated for you.

    Cheers

    Wilson

  • edwards142edwards142 Posts: 2Questions: 0Answers: 0

    If you are facing difficulty to export data to Excel then chance are may be that you not performing it well. Or you need to try some other way. So, I will suggest you to try some other way. As, exporting data to the Excel can be done in 4 different ways. Catch complete information from this link.

    http://www.repairmsexcel.com/blog/how-to-export-data-to-excel

Sign In or Register to comment.