How to change the style of a header in a export excel

How to change the style of a header in a export excel

MarcospdsrMarcospdsr Posts: 1Questions: 1Answers: 0

Hi!
I'm try to generat a excel from a datatable , but i need in de file te header has a header with a formatation, like logo and the one title for the spreedsheet
like the image
i create this code
var table = $('#DataTableRelatorio').DataTable(
{
ordering: true,
bLengthChange: false,
iDisplayLength: 10,
bFilter: false,
pagingType: "full",
bInfo: false,
dom: "Bfrtip",
buttons: [
{
extend: 'excel',
exportOptions:{orthogonal: 'export'},
text: 'Exportar Excel',
title: 'Relatório '
}],

Please help me

Answers

  • F12MagicF12Magic Posts: 109Questions: 0Answers: 28

    Quoted from @allan in other questions concerning similar questions :

    The Excel export provided by Buttons doesn't have the capability to add links, images, etc... You would need to customise the Excel file using the customize callback that the excelHtml5 button type offers. You'd also need to read and understand the Open Spreadsheet specification for how that would be implemented in the XML (I have no idea!).
    Allan.

    Styling the header and adding the column autofilters is possible through the customize callback as Allan said. Take a look at the comments in the excelHtml5 button reference.

This discussion has been closed.