/** * @class Ext.exporter.Base * @extend Ext.Base * @alias exporter.base * @mixin Ext.mixin.Factoryable * * This is the base class for an exporter. This class is supposed to be extended to allow * data export to various formats. * * The purpose is to have more exporters that can take the same {@link #data data set} and export it to different * formats. * * Exporters are used by {@link Ext.grid.plugin.Exporter} and {@link Ext.pivot.plugin.Exporter} * but could also be used individually when needed. * * If there is a requirement that the above plugins should export the data to a document format * that is currently not supported by the `exporter` package then it's better to extend this class * to create a custom exporter that does that. This way both plugins can use the same custom exporter. * * There are cases when tabular data that doesn't come from a grid panel or a pivot grid needs to * be exported to a file. This could be achieved using the available exporters independently. * * var exporter = Ext.Factory.exporter({ * type: 'excel', * data: { * columns: [{ * text: 'Vacation', * columns: [ * { text: 'Month', width: 200, style: { alignment: { horizontal: 'Right' } } }, * { text: 'Days', style: { format: 'General Number' } } * ] * }], * groups: [{ * text: 'Employees', * groups: [{ * text: 'Adrian', * rows: [{ * cells: [ * { value: 'January' }, * { value: 2 } * ] * },{ * cells: [ * { value: 'July' }, * { value: 10 } * ] * }], * summaries: [{ * cells: [ * { value: 'Total' }, * { value: 12 } * ] * }] * },{ * text: 'John', * rows: [{ * cells: [ * { value: 'March' }, * { value: 4 } * ] * },{ * cells: [ * { value: 'May' }, * { value: 4 } * ] * },{ * cells: [ * { value: 'July' }, * { value: 2 } * ] * }], * summaries: [{ * cells: [ * { value: 'Total' }, * { value: 10 } * ] * }] * }], * summaries: [{ * cells: [ * { value: 'Grand total' }, * { value: 22 } * ] * }] * }] * } * }); * * // save the file * exporter.saveAs().then( function() { exporter.destroy(); } ); * */ /** * @cfg {Ext.exporter.data.Table} [data=null] (required) * * Data to be consumed by the exporter. * @accessor */ /** * @cfg {Boolean} [showSummary=true] * * Should group summaries be shown? The data this exporter can consume * may contain group summaries. * @accessor */ /** * @cfg {String} [title=""] * * Title displayed above the table. Hidden when empty * @accessor */ /** * @cfg {String} [author="Sencha"] * * The author that generated the file. * @accessor */ /** * @cfg {String} [fileName="export.txt"] * * Name of the saved file * @accessor */ /** * @cfg {String} [charset="UTF-8"] * * File's charset * @accessor */ /** * @cfg {String} [mimeType="text/plain"] * * File's mime type * @accessor */ /** * @cfg {String} [binary=false] * * Set to `true` if the exporter generates a binary file. * @accessor */ /** * @method getContent * Generates the file content. */ /** * @method saveAs * Save the file on user's machine using the content generated by this exporter. * @return {Ext.promise.Promise} */ /** * @method getColumnCount * Returns the number of columns available in the provided `columns` array. * It will parse the whole tree structure to count the bottom level columns too. * @param columns * @return {Number} */