-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cpexcel.js problem #76
Comments
The script is pulled from the codepage module, which itself is the concatenation of two scripts (the one with the tables and the one with the utilities) The script was designed to run in the browser and in node. There is some logic in the utils script that calls require if the table is not defined. If you evaluate the script in a browser, the table is defined at the very beginning, so require is never run. I'm not too familiar with browserify. Is there a way to indicate that the require call won't run? As a stop-gap measure, replace lines 803-809 with just the
|
Thanks for your answer, but I use bower and load scripts from github, so I can't edit these scripts. |
@VolodymyrL I pushed a change that tricks browserify. Does |
@SheetJSDev I pulled updates but still have the same error - module "./cptable" not found from "F:.......\vendors\js-xlsx\dist\cpexcel.js"] |
Are you sure you pulled 0.7.6-h? The relevant line has been changed in 0.7.6-h. This is a simple browserify test on OSX 10.9.3:
|
I resturted solution and got this results and this new error { [Error: module "jszip" not found from "F:\Work\CoENode\public\vendors\js-xlsx\xlsx.js"]browserify --version bower install js-xlsx#0.7.6-h js-xlsx#0.7.6-h public\vendors\js-xlsx grep require vendors/js-xlsx/dist/cpexcel.js |
Adjusted the dependency but did not adjust the main repository :/ Please check against Thanks for following up |
browserify create vendors.js file without error but I got another errors in browser and it broke my app Uncaught Error: Cannot find module 'jszip' vendors.js:1 probably problem in the modules building Thanks for update! |
@VolodymyrL Sorry for the general confusion, I don't generally use browserify. I usually just add script tags :) |
Were you able to resolve the issue? Sent from my iPad
|
@SheetJSDev , no yet |
Can you share a sample gulp + browserify example so I can look further? |
@SheetJSDev I will try share sample example tomorrow. And another questions, can you add example how use js-xlsx with standard input type=file. I try implemented it by myself but got errors. I will try repeat it and send error to you. Thanks! |
I would think the standard approach (add an event listener for the change event of the input element, get the file at I just took the drag and drop code and changed a few names (target instead of dataTransfer), and this appears to work in chrome:
|
Thanks @SheetJSDev ! I had error with .addEventListener. Added jquery and sheet_to_json function. May will be helpful for someone
|
Hi @SheetJSDev did you add this fixes #76 (comment) to xlsx.core.min.js? If I try add this file to my project I get error 'Error: module "./dist/cpexcel" not found from' again. |
The original error was about cptable from cpexcel.js. Is this the same as the original issue? |
Yes, first I inclused jszip.js and xlsx.js, but now I try add xlsx.core.min.js and get this error in cpexcel.js |
The dist files need to be readjusted since the relative paths are taken from the root directory of the repo rather than the dist path. I will push an update soon |
Thanks |
We pushed version 0.8.7 with modified require paths. Please check whether this resolves the issue. |
I am still getting the same error. Cannot resolve file or directory ./cptable in ./node_modules/xlsx/dist |
I had another issue with my local configuration. With the latest version 0.8.7 along with web-pack demo config changes, it works perfect. Thanks for the support. |
I am right now trying to export a json data to an excel file using client side logic. But I am not able to create a workbook object to insert the json data to it. I could not find a proper info on the documentation too. could you help me with it ?
The code looks like this:
const wopts = { bookType: 'xlsx', bookSST: false, type: 'binary' };
const wbout = XLSX.write(wb, wopts); // How do I initialise 'wb' to use it here ?
function s2ab(s) {
const buf = new ArrayBuffer(s.length);
const view = new Uint8Array(buf);
for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
saveAs(new Blob([s2ab(wbout)], { type: 'application/octet-stream' }), 'test.xlsx');
|
@jayabhar Workbook object needs a As a simple example, here's a workbook with 2 worksheets:
|
Hi! I try use js-xlsx, bower and glup, but when I added 2 files to my progect
require('../vendors/js-xlsx/dist/jszip.js');
require('../vendors/js-xlsx/xlsx.js');
I got this error
{ [Error: module "./cptable" not found from "F:.......\vendors\js-xlsx\dist\cpexcel.js"]
plugin: 'gulp-browserify',
showStack: undefined,
name: 'Error',
message: 'module "./cptable" not found from "F:\.......\vendors\js-xlsx\dist\cpexcel.js"',
fileName: undefined,
lineNumber: undefined
I have cpexcel.js file in 'dist' folder.
Any idia how I can fix it? Thanks!
The text was updated successfully, but these errors were encountered: