How can add border in table during the print?

How can add border in table during the print?

saleemmssaleemms Posts: 5Questions: 3Answers: 0

Hi All,

I want to add border in the table when print. I am using below code but it's not working:

$(function () {

$('#printDebData').DataTable({
  dom: 'Bfrtip',
  "paging": false,
  "iDisplayLength": -1,
  buttons: [{               
                extend: 'print', footer: true,autoPrint: false,
                exportOptions: {
                    columns: [ 1, 2, 3 ]
                },
                customize: function ( doc ) {
                 $(doc.document.body).find('table').css('font-size', '10pt');
                 $(doc.document.body).find('table').css('border', '1px solid #000');
                 $(doc.document.body).find('table td').css('border-left', '1px solid #000');
                 $(doc.document.body).find('table td').css('border-top', '1px solid #000');
                 $(doc.document.body).find('table td').css('border-right', '1px solid #000');
                 $(doc.document.body).find('table td').css('border-bottom', '1px solid #000');
                },
                title:'<div style="text-align:center;"><h3>कीर इंडस्ट्रीज</h3></div><div style="text-align:center;font-size:13px;">कृषि मंडी के पीछे , बिलाड़ा<br />एरिया: <?php echo getAreaName($_REQUEST['area_id']); ?></div>'
            }],

});
});

When I print the paper, the border are not added in the printed paper. I want to add borders same as below screenshot:

Please help me.

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @saleemms ,

    This SO thread should help. If not, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.