UNPKG

excel-builder

Version:

An easy way of building Excel files with javascript

48 lines (39 loc) 1.21 kB
"use strict"; /** * @module Excel/Pane * * https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.pane%28v=office.14%29.aspx */ var _ = require('lodash'); var Pane = function () { /* Possible Values: null split Split frozen Frozen frozenSplit Frozen Split http://www.datypic.com/sc/ooxml/t-ssml_ST_PaneState.html */ this.state = null; this.xSplit = null; this.ySplit = null; this.activePane = 'bottomRight'; this.topLeftCell = null; }; _.extend(Pane.prototype, { freezePane: function(column, row, cell) { this._freezePane = {xSplit: column, ySplit: row, cell: cell}; }, exportXML: function (doc) { var pane = doc.createElement('pane'); if(this.state !== null) { pane.setAttribute('xSplit', this._freezePane.xSplit); pane.setAttribute('ySplit', this._freezePane.ySplit); pane.setAttribute('topLeftCell', this._freezePane.cell); pane.setAttribute('activePane', 'bottomRight'); pane.setAttribute('state', 'frozen'); } return pane; } }); module.exports = Pane;