linways / table-to-excel

Javascript library to create "valid" excel file from html table with styles
MIT License
224 stars 108 forks source link

Not working in IE11 #34

Open PetarMG-BG opened 4 years ago

PetarMG-BG commented 4 years ago

Hello, the lib is perfect but it's not working on IE11, because of Object.assign. I was trying to add the polyfill but still not working trowing the following error:

'Symbol' is undefined

Can somebody help?

rohithb commented 4 years ago

I don't have a windows machine to check the compatibility on IE11. I think you could try rebuilding the the source code following this issue. Try building the package by adding the following in the babel configuration defined in package.json as mentioned in https://babeljs.io/docs/en/babel-preset-env

{
  "targets": {
    "ie": "11"
  }
}
PetarMG-BG commented 4 years ago

I don't have a windows machine to check the compatibility on IE11. I think you could try rebuilding the the source code following this issue. Try building the package by adding the following in the babel configuration defined in package.json as mentioned in https://babeljs.io/docs/en/babel-preset-env

{
  "targets": {
    "ie": "11"
  }
}

Thanks for your response. I'm not using a builder, I'm using this in the browser and just I get the js file. When I add the following polyfill: `if (typeof Object.assign !== 'function') { // Must be writable: true, enumerable: false, configurable: true Object.defineProperty(Object, "assign", { value: function assign(target, varArgs) { // .length of function is 2 'use strict'; if (target === null || target === undefined) { throw new TypeError('Cannot convert undefined or null to object'); }

  var to = Object(target);

  for (var index = 1; index < arguments.length; index++) {
    var nextSource = arguments[index];

    if (nextSource !== null && nextSource !== undefined) { 
      for (var nextKey in nextSource) {
        // Avoid bugs when hasOwnProperty is shadowed
        if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
          to[nextKey] = nextSource[nextKey];
        }
      }
    }
  }
  return to;
},
writable: true,
configurable: true

}); }` From:

The Object.assgin is nomore an error, but it trows an error about undefined Symbol

PetarMG-BG commented 4 years ago

Can somebody help with this?