嗨,我正在使用 Node 的 exceljs 库,我正在读取一个文件,用作我们的 Excel 模板,我想将 addrows 函数与列的标题属性一起使用,但我在文档中没有看到如何将标题放在与第一行不同的另一行上。
我正在做这个。
var headers = [
{header:'Cliente',key:'client_name' ,width: 18}, //i need something like startRow:2
{header:'N° Visitas',key:'visits' ,width: 10},
{header:'Visitas Periodo Anterior',key:'visits_old' ,width: 10},
{header:'Ultima visita',key:'last_visit',style: { numFmt: 'DD/MM/YYYY HH:mm:ss' },width: 22},
{header:'Ultima Persona en Visitarlo',key:'device_name' ,width: 18}
];
var libro = workbook.xlsx.readFile(template_file)
.then(function() {
var worksheet = workbook.getWorksheet(1);
worksheet.columns = headers;
worksheet.addRows(data);
//row.height=40;
worksheet.getRow(1).hidden=false;
worksheet.getRow(2).hidden=false;
//row.height=40;
workbook.xlsx.writeFile(output)
注意:抱歉,如果我拼写错误。
var dobCol = worksheet.getRow(1); // You can define a row like 2 , 3
dobCol.header = [{
{header:'Cliente',key:'client_name' ,width: 18}, //i need something like startRow:2
{header:'N° Visitas',key:'visits' ,width: 10},
{header:'Visitas Periodo Anterior',key:'visits_old' ,width: 10},
{header:'Ultima visita',key:'last_visit',style: { numFmt: 'DD/MM/YYYY HH:mm:ss' },width: 22},
{header:'Ultima Persona en Visitarlo',key:'device_name' ,width: 18}
}];
我是一名优秀的程序员,十分优秀!