How to use the jszip.prototype function in jszip

To help you get started, we’ve selected a few jszip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hagasatoshi / js-merge-xlsx / src / lib / Excel.js View on Github external
/**
 * Excel
 * @author Satoshi Haga
 * @date 2016/03/27
 */

const Promise = require('bluebird');
const xml2js = require('xml2js');
const parseString = Promise.promisify(xml2js.parseString);
const builder = new xml2js.Builder();
const _ = require('underscore');
require('./underscore');
const config = require('./Config');
let Excel = require('jszip');

_.extend(Excel.prototype, {

    //read as encoded strings
    sharedStrings: function() {
        return this.file(config.EXCEL_FILES.FILE_SHARED_STRINGS).asText();
    },

    parseSharedStrings: function() {
        return this.parseFile(config.EXCEL_FILES.FILE_SHARED_STRINGS);
    },

    //save with xml-encoding
    setSharedStrings: function(obj) {
        if(obj) {
            this.file(config.EXCEL_FILES.FILE_SHARED_STRINGS, builder.buildObject(obj));
        }
        return this;

jszip

Create, read and edit .zip files with JavaScript http://stuartk.com/jszip

(MIT OR GPL-3.0-or-later)
Latest version published 2 years ago

Package Health Score

80 / 100
Full package analysis