尝试更改打印页面标题的字体时遇到问题。我使用了基于此文档的自定义方法
这是我的代码:
$(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' );
}
}
]
} );
} );
但是标题字体仍然没有改变,这是屏幕截图:
如您所见,“所有服务”的大字体仍然很大。
有什么建议可以解决这个问题吗?谢谢
标题在<h1>
html 标记上。因此,您可以更改此标记的所有 css 样式。
例如:
customize: function ( doc ) {
$(doc.document.body).find('h1').css('font-size', '15pt');
$(doc.document.body).find('h1').css('text-align', 'center');
}
等等。 ;)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句