How to include line breaks when printing

How to include line breaks when printing

justStevejustSteve Posts: 49Questions: 8Answers: 1

I'm creating cell contends like:
"mRender": function (data, type, full) {
return full.LastName + ", " + full.FirstName + "<br>" + full.BillingEmail + "<br>" + full.Institution;

When printing or exporting the <br> is not honored. I tried inserting a javascript line break char (\n) without success. Any workarounds?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,831Questions: 1Answers: 10,132 Site admin
    Answer ✓

    You can use the scriptHtml option of buttons.exportData() to have Buttons not strip the HTML. You use the exportOptions object of the print button to set the options passed to the export method.

    Allan

  • justStevejustSteve Posts: 49Questions: 8Answers: 1

    Someone else might find this syntax useful

                'buttons': [{
                    extend: 'print',
                    text: 'Print current page',
                    exportOptions: {
                        stripHtml: false
                    }
                }, {
                    extend: 'pdf',
                    text: 'Save PDF',
                    exportOptions: {
                        stripNewlines: false
                    }
                }
                ],
    
This discussion has been closed.