Socket
Socket
Sign inDemoInstall

exceljs

Package Overview
Dependencies
Maintainers
1
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exceljs - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0

16

dist/es5/doc/row.js

@@ -111,6 +111,10 @@ 'use strict';

cDst.value = cSrc.value;
cDst.style = cSrc.style;
cDst.style = cSrc.style; // eslint-disable-next-line no-underscore-dangle
cDst._comment = cSrc._comment;
} else if (cDst) {
cDst.value = null;
cDst.style = {};
cDst.style = {}; // eslint-disable-next-line no-underscore-dangle
cDst._comment = undefined;
}

@@ -126,3 +130,5 @@ }

cDst.value = cSrc.value;
cDst.style = cSrc.style;
cDst.style = cSrc.style; // eslint-disable-next-line no-underscore-dangle
cDst._comment = cSrc._comment;
} else {

@@ -138,3 +144,5 @@ this._cells[i + nExpand - 1] = undefined;

cDst.value = inserts[i];
cDst.style = {};
cDst.style = {}; // eslint-disable-next-line no-underscore-dangle
cDst._comment = undefined;
}

@@ -141,0 +149,0 @@ } // Iterate over all non-null cells in this row

@@ -13,5 +13,5 @@ 'use strict';

var XLSX = require('./../xlsx/xlsx');
var XLSX = require('../xlsx/xlsx');
var CSV = require('./../csv/csv'); // Workbook requirements
var CSV = require('../csv/csv'); // Workbook requirements
// Load and Save from file and stream

@@ -18,0 +18,0 @@ // Access/Add/Delete individual worksheets

"use strict";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

@@ -272,4 +278,9 @@

value: function addRow(value) {
var row = this.getRow(this._nextRow);
var styleOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'n';
var rowNo = this._nextRow;
var row = this.getRow(rowNo);
row.values = value;
this._setStyleOption(rowNo, styleOption === 'i' ? styleOption : 'n');
return row;

@@ -282,7 +293,61 @@ }

var styleOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'n';
value.forEach(function (row) {
_this2.addRow(row);
_this2.addRow(row, styleOption);
});
}
}, {
key: "insertRow",
value: function insertRow(pos, value) {
var styleOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'n';
this.spliceRows(pos, 0, value);
this._setStyleOption(pos, styleOption);
return this.getRow(pos);
}
}, {
key: "insertRows",
value: function insertRows(pos, values) {
var styleOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'n';
this.spliceRows.apply(this, [pos, 0].concat(_toConsumableArray(values)));
if (styleOption !== 'n') {
// copy over the styles
for (var i = 0; i < values.length; i++) {
if (styleOption === 'o' && this.findRow(values.length + pos + i) !== undefined) {
this._copyStyle(values.length + pos + i, pos + i);
} else if (styleOption === 'i' && this.findRow(pos - 1) !== undefined) {
this._copyStyle(pos - 1, pos + i);
}
}
}
} // set row at position to same style as of either pervious row (option 'i') or next row (option 'o')
}, {
key: "_setStyleOption",
value: function _setStyleOption(pos) {
var styleOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'n';
if (styleOption === 'o' && this.findRow(pos + 1) !== undefined) {
this._copyStyle(pos + 1, pos);
} else if (styleOption === 'i' && this.findRow(pos - 1) !== undefined) {
this._copyStyle(pos - 1, pos);
}
}
}, {
key: "_copyStyle",
value: function _copyStyle(src, dest) {
var rSrc = this.getRow(src);
var rDst = this.getRow(dest);
rDst.style = Object.freeze(_objectSpread({}, rSrc.style)); // eslint-disable-next-line no-loop-func
rSrc.eachCell({
includeEmpty: true
}, function (cell, colNumber) {
rDst.getCell(colNumber).style = Object.freeze(_objectSpread({}, cell.style));
});
rDst.height = rSrc.height;
}
}, {
key: "duplicateRow",

@@ -289,0 +354,0 @@ value: function duplicateRow(rowNum, count) {

@@ -769,3 +769,3 @@ "use strict";

if (utils.isDateFmt(cell.numFmt)) {
cell.value = utils.excelToDate(parseFloat(c.v.text), properties.model.date1904);
cell.value = utils.excelToDate(parseFloat(c.v.text), properties.model && properties.model.date1904);
} else {

@@ -772,0 +772,0 @@ cell.value = parseFloat(c.v.text);

@@ -15,3 +15,3 @@ "use strict";

this._totalRefs = 0;
this._hash = {};
this._hash = Object.create(null);
}

@@ -18,0 +18,0 @@

declare interface Buffer extends ArrayBuffer { }
export const enum RelationshipType {
export declare enum RelationshipType {
None = 0,

@@ -14,3 +14,3 @@ OfficeDocument = 1,

export const enum DocumentType {
export declare enum DocumentType {
Xlsx = 1

@@ -276,3 +276,3 @@ }

export const enum ReadingOrder {
export declare enum ReadingOrder {
LeftToRight = 1,

@@ -323,2 +323,12 @@ RightToLeft = 2,

export declare enum ErrorValue {
NotApplicable = '#N/A',
Ref = '#REF!',
Name = '#NAME?',
DivZero = '#DIV/0!',
Null = '#NULL!',
Value = '#VALUE!',
Num = '#NUM!',
}
export interface CellErrorValue {

@@ -355,3 +365,3 @@ error: '#N/A' | '#REF!' | '#NAME?' | '#DIV/0!' | '#NULL!' | '#VALUE!' | '#NUM!';

export const enum ValueType {
export declare enum ValueType {
Null = 0,

@@ -370,3 +380,3 @@ Merge = 1,

export const enum FormulaType {
export declare enum FormulaType {
None = 0,

@@ -388,3 +398,3 @@ Master = 1,

}
export interface CommentProtection {

@@ -394,3 +404,3 @@ locked: 'True' | 'False';

}
export type CommentEditAs = 'twoCells' | 'oneCells' | 'absolute';

@@ -1193,3 +1203,3 @@

*/
addRow(data: any[] | any): Row;
addRow(data: any[] | any, styleOption: string): Row;

@@ -1199,5 +1209,17 @@ /**

*/
addRows(rows: any[]): void;
addRows(rows: any[], styleOption: string): void;
/**
* Insert a Row by key-value, at the pos (shifiting down all rows from pos),
* using the column keys, or add a row by contiguous Array (assign to columns A, B & C)
*/
insertRow(pos: number, value: any[] | any, styleOption: string): Row;
/**
* Insert multiple rows at pos (shifiting down all rows from pos)
* by providing an array of arrays or key-value pairs
*/
insertRows(pos: number, values: any[], styleOption: string): void;
/**
* Duplicate rows and insert new rows

@@ -1947,3 +1969,3 @@ */

read(): Promise<void>;
[Symbol.asyncIterator]: AsyncIterator<WorksheetReader>;
[Symbol.asyncIterator](): AsyncGenerator<WorksheetReader>;
parse(): AsyncIterator<any>;

@@ -1962,3 +1984,3 @@ }

read(): Promise<void>;
[Symbol.asyncIterator]: AsyncIterator<Row>;
[Symbol.asyncIterator](): AsyncGenerator<Row>;
parse(): AsyncIterator<Array<any>>;

@@ -1965,0 +1987,0 @@ dimensions(): number;

@@ -94,5 +94,9 @@ 'use strict';

cDst.style = cSrc.style;
// eslint-disable-next-line no-underscore-dangle
cDst._comment = cSrc._comment;
} else if (cDst) {
cDst.value = null;
cDst.style = {};
// eslint-disable-next-line no-underscore-dangle
cDst._comment = undefined;
}

@@ -108,2 +112,4 @@ }

cDst.style = cSrc.style;
// eslint-disable-next-line no-underscore-dangle
cDst._comment = cSrc._comment;
} else {

@@ -120,2 +126,4 @@ this._cells[i + nExpand - 1] = undefined;

cDst.style = {};
// eslint-disable-next-line no-underscore-dangle
cDst._comment = undefined;
}

@@ -122,0 +130,0 @@ }

@@ -5,4 +5,4 @@ 'use strict';

const DefinedNames = require('./defined-names');
const XLSX = require('./../xlsx/xlsx');
const CSV = require('./../csv/csv');
const XLSX = require('../xlsx/xlsx');
const CSV = require('../csv/csv');

@@ -9,0 +9,0 @@ // Workbook requirements

@@ -337,14 +337,56 @@ const _ = require('../utils/under-dash');

addRow(value) {
const row = this.getRow(this._nextRow);
addRow(value, styleOption = 'n') {
const rowNo = this._nextRow;
const row = this.getRow(rowNo);
row.values = value;
this._setStyleOption(rowNo, styleOption === 'i' ? styleOption : 'n');
return row;
}
addRows(value) {
addRows(value, styleOption = 'n') {
value.forEach(row => {
this.addRow(row);
this.addRow(row, styleOption);
});
}
insertRow(pos, value, styleOption = 'n') {
this.spliceRows(pos, 0, value);
this._setStyleOption(pos, styleOption);
return this.getRow(pos);
}
insertRows(pos, values, styleOption = 'n') {
this.spliceRows(pos, 0, ...values);
if (styleOption !== 'n') {
// copy over the styles
for (let i = 0; i < values.length; i++) {
if (styleOption === 'o' && this.findRow(values.length + pos + i) !== undefined) {
this._copyStyle(values.length + pos + i, pos + i);
} else if (styleOption === 'i' && this.findRow(pos - 1) !== undefined) {
this._copyStyle(pos - 1, pos + i);
}
}
}
}
// set row at position to same style as of either pervious row (option 'i') or next row (option 'o')
_setStyleOption(pos, styleOption = 'n') {
if (styleOption === 'o' && this.findRow(pos + 1) !== undefined) {
this._copyStyle(pos + 1, pos);
} else if (styleOption === 'i' && this.findRow(pos - 1) !== undefined) {
this._copyStyle(pos - 1, pos);
}
}
_copyStyle(src, dest) {
const rSrc = this.getRow(src);
const rDst = this.getRow(dest);
rDst.style = Object.freeze({...rSrc.style});
// eslint-disable-next-line no-loop-func
rSrc.eachCell({includeEmpty: true}, (cell, colNumber) => {
rDst.getCell(colNumber).style = Object.freeze({...cell.style});
});
rDst.height = rSrc.height;
}
duplicateRow(rowNum, count, insert = false) {

@@ -351,0 +393,0 @@ // create count duplicates of rowNum

@@ -324,3 +324,3 @@ const {EventEmitter} = require('events');

if (utils.isDateFmt(cell.numFmt)) {
cell.value = utils.excelToDate(parseFloat(c.v.text), properties.model.date1904);
cell.value = utils.excelToDate(parseFloat(c.v.text), properties.model && properties.model.date1904);
} else {

@@ -327,0 +327,0 @@ cell.value = parseFloat(c.v.text);

@@ -5,3 +5,3 @@ class SharedStrings {

this._totalRefs = 0;
this._hash = {};
this._hash = Object.create(null);
}

@@ -8,0 +8,0 @@

{
"name": "exceljs",
"version": "4.0.1",
"version": "4.1.0",
"description": "Excel Workbook Manager - Read and Write xlsx and csv Files.",

@@ -5,0 +5,0 @@ "private": false,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc