Style for Excel output
You can separately apply styles for Excel output by specifying the exportStyleName property on the header, footer, and column.
When output to Excel, the background color of the "Name" column header and "Gender" column data cells is set to blue.
Download Excel
gridView.exportGrid({
type: "excel",
target: "local",
fileName: "gridExportSample.xlsx",
applyDynamicStyles: true;
done: function () {
alert("done excel export")
}
});
set exportStyleName
var columns = [
{
name: "KorName",
fieldName: "KorName",
width: "60",
header: {
text: "Name",
exportStyleName: "blueColor"
},
},
{
name: "Gender",
fieldName: "Gender",
width: "40",
header: {
text: "Gender"
},
exportStyleName: "blueColor"
},
...
Dynamic Excel Styles
You can also use the exportStyleName property for dynamic styles.
styleCallback: function(grid, dataCell){
var ret = {}
if(dataCell.value == true){
ret.styleName = "blue-column"
ret.exportStyleName = "yellow-color"
}
return ret;
}