API call exportTo
Export and print
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="excel()">Export to Excel</button>
<div id="pivot-container"></div>
JavaScript
var labelItems = ["Balance Sheet Statement","Equity And Liabilities"],
totalItems = ["Total Equity and Liabilites",""] ;
function customizeCellFunction(cell, data) {
if(data.rows.length != 0) {
let caption = data.rows[0].caption.trim();
if(labelItems.indexOf(caption) !=-1) {
cell.style = Object.assign(cell.style,{
"font-weight":"bold",
"color":"#337ab7"
});
} else if(totalItems.indexOf(caption) !=-1 ) {
cell.style = Object.assign(cell.style,{
"font-weight":"bold"
});
}
}
}
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
customizeCell: customizeCellFunction,
report: {
"dataSource": {
"data": [
{
"ledger_type": {
"type": "string",
"caption": "Ledger Type"
},
"period_id": {
"type": "string",
"caption": "Period Id"
},
"period_id_desc": {
"type": "property",
"caption": "Period Id"
},
"item_seq_id": {
"type": "string",
"caption": "Item Label"
},
"item_name_desc": {
"type": "property",
"caption": "Item Label"
},
"derived": {
"type": "number",
"caption": "Reported Value"
},
"currency_id": {
"type": "string",
"caption": "Currency"
},
"currency_desc": {
"type": "property",
"caption": "Currency"
},
"entity": {
"type": "string",
"caption":...