Customizing table export with TableTools

Customizing table export with TableTools

jasontt33jasontt33 Posts: 3Questions: 2Answers: 0
edited July 2015 in Free community support

Is it possible to add a title row to the CSV and PDF TableTool exports? Above the column titles maybe?

This question has an accepted answers - jump to answer

Answers

  • AshbjornAshbjorn Posts: 55Questions: 2Answers: 16
    edited July 2015 Answer ✓

    Hi jasontt33,

    You can specify a custom message to be displayed on the top of your PDF.

    See this page: TableTools - Custom PDF message.

    $(document).ready(function() {
        $('#example').DataTable( {
            dom: 'T<"clear">lfrtip',
            tableTools: {
                "aButtons": [
                    "copy",
                    "csv",
                    "xls",
                    {
                        "sExtends": "pdf",
                        "sPdfOrientation": "landscape",
                        "sPdfMessage": "Your custom message would go here."
                    },
                    "print"
                ]
            }
        } );
    } );
    

    AFAIK no such option would exist for CSV files, since that would effectively break the CSV format and the ability for the file to be read in other programs.

    Hope this helps,

  • jasontt33jasontt33 Posts: 3Questions: 2Answers: 0

    Thanks, Ashbjorn. That does help with the PDF. You are right, didn't really think about it, but the CSV has no formatting associated with it.

This discussion has been closed.