I am using datatables.net library for exporting data into pdf and excel but when downloading the data it is aligning in single line

13 views Asked by At

enter image description here

This is my code:-

 $(document).ready(function() {
    $('#myTable-0').DataTable( {
            "searching": true,
            dom: 'Bfrtip',
            pagingType: "full_numbers",
            orientation: 'landscape',
            pageSize: 'A4', 
            alignment: "center",
            lengthMenu: [
                [25, 50, 100, 200, -1],
                [25, 50, 100, 200, "All"]
            ],
            iDisplayLength: 100,

            buttons: [
                'csv', 'excel', 'pdf'

            ],
        } );
} );

This is my code:-

 $(document).ready(function() {
    $('#myTable-0').DataTable( {
            "searching": true,
            dom: 'Bfrtip',
            pagingType: "full_numbers",
            orientation: 'landscape',
            pageSize: 'A4', 
            alignment: "center",
            lengthMenu: [
                [25, 50, 100, 200, -1],
                [25, 50, 100, 200, "All"]
            ],
            iDisplayLength: 100,

            buttons: [
                'csv', 'excel', 'pdf'

            ],
        } );
} );

I am expecting something like this organised data:-

enter image description here

i don't know how to achieve this, please help me in this question.

0

There are 0 answers