Trying to center a full table on print, instead of aligning to the left with content:
Have tried adding the following code in bold but doesn't do anything for me.
I also have a variable amount of columns for all my tables, is there a way to make something like this work for every table?
$('#myTable').DataTable( {
buttons: [
{ content: [
{
'alignment': 'center',
table: {
body: [
['Column 1', 'Column 2', 'Column 3'],
['One value goes here', 'Another one here', 'OK?']
]
}
}
],
extend: 'pdfHtml5',
text: 'Save current page',
exportOptions: {
modifier: {
page: 'current'
}
}
}
]
} );
Table aligment issue https://github.com/bpampuch/pdfmake/issues/72 exists, but use this workaround:
var dd = {
content: [
{
columns: [
{ width: '*', text: '' },
{
width: 'auto',
table: {
body: [
['Column 1', 'Column 2', 'Column 3'],
['One value goes here', 'Another one here', 'OK?']
]
}
},
{ width: '*', text: '' },
]
}
]
}
Thanks, but I can't seem to combine your code with my code above and I've tried for an hour now (and some hours yesterday).
How would it all look together? I am using DataTables above.
I don't use DataTable library so I do not know. Ask on DataTable support.
Most helpful comment
Table aligment issue https://github.com/bpampuch/pdfmake/issues/72 exists, but use this workaround: