Header with SheetJS

0

Good afternoon, I'm using SheetJS library to export data from a JSON to an excel sheet. I need to create a formatted header and found nothing similar. My code looks like this:

function excelOut(data){

const wb = { SheetNames: [], Sheets: {} };
wb.Props = {
    Title: "aaa",
    Subject: "Dados de outorga",
    Author: "jjjjj",
    CreateDate: new Date()
};

let jsonText
jsonText = JSON.stringify(getDados(data), "\t")
jsonText = JSON.parse(jsonText)

var wscols = [
    {wch:15},
    {wch:20},
    {wch:20},
    {wch:20},
    {wch:20},
    {wch:20},
    {wch:20},
    {wch:20},
    {wch:20}
]

var ws = XLSX.utils.json_to_sheet(
    jsonText
)    

ws['!cols'] = wscols;
var ws_name = "Outorga"
XLSX.utils.book_append_sheet(wb, ws, ws_name)
let wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'binary' })
saveAs(new Blob([s2ab(wbout)], { type: "application/octet-stream" }), 'Outorga.xlsx');

}

I need to generate a header similar to the red image:

    
asked by anonymous 05.07.2018 / 22:41

0 answers