I have a problem when attempting to change my printed page title's font. I've used the customize method based on this documentation
and here's my code:
$(document).ready(function() {
$('#tabelservis').DataTable( {
"columnDefs": [
{ "type": "numeric-comma", targets: [0, 3] }
],
dom: 'Bfrtip',
buttons: [
{
extend: 'copyHtml5',
exportOptions: {
columns: [ 0, ':visible' ]
}
},
{
extend: 'excel',
exportOptions: {
columns: [ 0,1, 2, 3, 4 ]
}
},
{
extend: 'print',
title: 'All of Services',
exportOptions: {
columns: [ 0,1, 2, 3, 4 ]
},
customize: function ( win ) {
$(win.document.body)
.css( 'font-size', '12px' );
$(win.document.body).find( 'table' )
.css( 'font-size', '12px' );
}
}
]
} );
} );
But still the title font is not changing, here's the screenshot:
As you can see, the big "All of services" still has big font size.
Any suggestions to solve this? Thank you
The title is on <h1>
html markers.
So You can change all css style for this marker.
For example:
customize: function ( doc ) {
$(doc.document.body).find('h1').css('font-size', '15pt');
$(doc.document.body).find('h1').css('text-align', 'center');
}
Etc. ;)
Try wrapping your title in a div with style setting the font size:-
buttons [
extend: 'print',
title: function() {
return "<div style='font-size: 14px;'>My Title</div>";
}
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With