Search code examples
htmlpdfdatatablespdfmake

datatables PDF - Export without border only after certain row


Is there anyway to remove the border after certain rows when exporting PDF from datatables. Example as below

  1. This is the datatables shown on the browser with the formatting

Browser DT

  1. This is the exported PDF from the datatables above

Exported PDF

Is there any way that i can remove all borders in the exported PDF after the AVG (WE) row to show the same as what i see in the datatables shows in the 1st picture?

I have been trying to find this out for quite some time, but cannot find any working code. Really appreciate any solution i can get. Thank you so much


Solution

  • I manage to do this by appending captions into the datatables, it will show the caption after all data is populated out in the datatables and when trying to export it, it will only show in the last page. Add in the caption code right before your datatables js

    $('#dtBasicExample').append('<br/>');
          $('#dtBasicExample').append('<caption style="caption-side: bottom">\nInsert Caption Here</caption>');
    
    $('#dtBasicExample').dataTable({ ... });