Regrading PDF and EXCEL export from Datatable.

Regrading PDF and EXCEL export from Datatable.

AravindkumarAravindkumar Posts: 5Questions: 2Answers: 0

I have an problem in pdf and excel export from data table. I need to attach watermark , header with images and footer with downloaded date and time. I have tried many extension but no use. If someone got to know how to do, please let tell me. Advance thanks..

Answers

  • allanallan Posts: 63,075Questions: 1Answers: 10,385 Site admin

    You would use the customize option. For example.

    Allan

  • AravindkumarAravindkumar Posts: 5Questions: 2Answers: 0
    edited February 2016

    Hi Allan,
    Thanks for your response. and am using customize option, but only for header, its working perfect, but I need to attach watermark and footer mark. Here i have paste my code, please review that, if there is any mistake for watermark and footer, please let tell me. Thanks again.

    Code goes here:

    buttons: [
                {
                    extend: 'pdf', 
                    text: 'PDF all'
                },
                {
                    extend: 'excel', 
                    text: 'excel all'
                },
                {
                    extend: 'pdf',
                    text: 'PDF',
                    customize: function ( doc ) {
                        doc.content.splice( 1, 0, {
                            margin: [ 20, 20, 20, 20 ],
                            alignment: 'center',
                            text: 'ABCD1234',
                        } );
                       doc.content.splice( 1, 0, {
                            margin: [ 20, 20, 20, 20 ],
                            alignment: 'center',
                            watermark: 'ABCD1234',
                        } );
                    },
                    exportOptions: {
                        modifier: {
                            selected: true
                        }
                    }
                },
                {
                    extend: 'excel',
                    text: 'excel',
    
                    exportOptions: {
                        modifier: {
                            selected: true
                        }
                    }
                }
            ],
    

    Review my code and tel me if there is any issues in my code..

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

  • allanallan Posts: 63,075Questions: 1Answers: 10,385 Site admin

    I would need a link to the page to be able to debug it.

This discussion has been closed.