Firstly a big compliment on the contributors of the alasql
-project. It helps me a lot to export my JSON data to excel file. But for the next steps, I need some help about formatting the excel file.
Is it possible to define the cells with an automatically width? And I need to color one column.
I have been seen a post in an other thread, but this didn't work in my example.
Here is my code:
var opts = {
headers: true,
column: {
style: {
Font: {
Bold: "1"
}
}
},
rows: {
1: {
style: {
Font: {
Color: "#FF0077"
}
}
}
},
cells: {
1: {
1: {
style: {
Font: {
Color: "#00FFFF"
}
}
}
}
}
};
vm.btnExport = function () {
alasql('shortcode AS Short_Code, \ ' +
'fname AS Fullname, \ ' +
'INTO XLSX("test.xlsx", ?) FROM ?', [opts, vm.list]);
};
I have got great idea try with this..
var opts = {
sheetid : ' Report',
headers : true,
style : 'font-size:25px',
caption : {
title : 'Report',
},
columns : [
{
title : "column Name",
columnid : "key value"
}
],
rows: {
//for putting background color in particular column
0: {
cell: {
style: 'font-size:17px;background:#115ea2;color:white;font-weight:bold'
}
},
},
cells: {
//if you want to put style in particular cell
1: {
5: {
style: 'font-size:20px;background:#115ea2 ;color:white;font-weight:bold;text-align:right',
value: function(value){return value;}
},
}
}
};
vm.btnExport = function () {
alasql('shortcode AS Short_Code, \ ' +
'fname AS Fullname, \ ' +
'INTO XLSX("test.xlsx", ?) FROM ?', [opts, vm.list]);
};