Check documentation for the latest version of DHTMLX Pivot export Pivot Docs

export

exports Pivot data to an Excel file

object export(object settings);

Deprecated

The method will be removed in the next version. Use pivot.export.xlsx() instead:

pivot.export.xlsx({
    name:"pivot_data",
    url:"//export.dhtmlx.com/excel"
});

Check the Exporting Pivot section for more details.

settingsobjectan object with export settings: the name of the exported file and the URL that executes export
objectan object with exported data parameters

Example

pivot.export({
    name:"pivot_data",
    url:"//export.dhtmlx.com/excel"
});

Details

The returned data object contains the following parameters:

  • the name of the exported Excel file
  • the columns configuration set as an array of objects. Each object stores the width of a column:
  • the column headers set as a matrix of header cells, null values are provided for cells in colspans or rowspans:
  • the data of Pivot defined as a matrix, where each cell stores a single value - the value of the related cell
  • the styles array that includes:
    • a set of styles. It is specified as a css object. Each style is defined as a hash of key:value pairs, where the key is the name of the style and the value is an object with the style attributes
    • a set of cells. It is specified as a cells matrix. Each cell is defined as an array that contains three elements: the number of a column, the number of a row, and the name of a CSS class applied to this cell (from the css object)

For example:

var data = {
    name:"pivot_data",
    columns:[
        { width: 100 },
        { width: 100 }
        // more objects
    ],
    header:[
        [" ", " ", "Q1", " ", "Q2", " "],
        [" ", " ", "Oil (Max)", "Oil (Min)", "Oil (Max)", "Oil (Min)"]
    ],
    data:[
        ["Constitutional monarchy", " ", "78.276", "2.946", "80.259", "5.564"],
        [" ", 2012, "23.650", "23.650", "80.259", "51.127"],
        // more arrays with cells values
    ],
    styles:[
        css:{
            major:{ color: "#ff00ff", background: "#0000AA", fontSize: 14 }
        },
        cells:[
            [1,2,"major"]
        ]
    ]
}

Related sample:  Export

See also
Change log

deprecated since v1.4

Back to top