Open maubarrerag opened 5 years ago
any updates on this issue @maubarrerag ?
@Rawia-Intouch not yet.
@andreyan-andreev Hey, can you push this one: https://github.com/andreyan-andreev/node-excel-export/pull/49 ? it seems that it will fix the current issue
I was able to export an excel file without a second row with [Object]. This usually happens when we do not pass the headerStyle in specification. Pass an empty object ({}) and it'll resolve our problem. Here's my code
` //Here you specify the export structure const specification = { customer_name: { // <- the key should match the actual data key displayName: 'Customer', // <- Here you specify the column header headerStyle: {}, // <- Header style width: 120 // <- width in pixels }, status_id: { displayName: 'Status', headerStyle: {}, width: '10' // <- width in chars (when the number is passed as string) } }
const dataset = [ {customer_name: 'IBM', status_id: 1}, {customer_name: 'HP', status_id: 0}, {customer_name: 'MS', status_id: 0} ]
return excel.buildExport( [ // <- Notice that this is an array. Pass multiple sheets to create multi sheet report { name: 'Sales', // <- Specify sheet name (optional) heading: [], // <- Raw heading array (optional) specification: specification, // <- Report specification data: dataset // <-- Report data } ] ); `
After exporting excel i noticed that a new row was added, not sure where that data came from, data is ok.
var specs = { UnitId: {width:80}, type: {width:100},fecha: {width:200}, latitude:{width:100}, longitude: {width:100}, engineSpeed: {width:80}, totalUsedFuel:{width:80}, fuelRate:{width:80}, fuelLevel: {width:80} };
var dataset = data;
var report = excel.buildExport([{ name: 'KPIs', heading: heading, specification: specs, data: dataset }]);
Do i need to specify the merge param?