Skip to content
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

status of this project? #125

Open
westwick opened this issue Nov 30, 2018 · 9 comments
Open

status of this project? #125

westwick opened this issue Nov 30, 2018 · 9 comments

Comments

@westwick
Copy link

Hello, I found this repo like most people after realizing the original forked project doesn't provide style support, and am trying to incorporate it into an Angular project. I have it working but it feels very "hacky" and just wondering if this is normal, or am I doing something wrong, and what the status of this fork is?

For example, to even get it to work I had to modify cpexcel.js and remove the require for cptable (replaced with var cpt = cptable;). Should this change be committed and released to npm?

Also, some of the functionality from original xlsx-js appeared to not be working in this fork, e.g. utils.book_new() was not working, utils.book_append_sheet(), utils.json_to_sheet(), writeFile(), etc. -- so what I ended up having to do was use both forks of this project, and export from xlsx then import into xlsx-style, like so:

import * as XLSX from 'xlsx';
import * as sheets from 'xlsx-style';

const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, someSheet, 'sheetname');
const out = XLSX.write(wb, { type: 'base64'});

// take the output from xlsx lib and pass it into xlsx-style lib
const styledwb = sheets.read(out);
// we can now apply styles
// however writeFile wasn't working so had to add implementation to convert and trigger download with file-saver
const newOut = sheets.write(styledwb, wopts); // ouput type=binary
const test = new Blob([this.s2ab(newOut)], {type: ''});
saveAs(test, 'test.xlsx');

So this all works, but I guess my big question is, am I doing something wrong? Are those functions expected to work in this fork, or is the above code basically necessary at this point in time? Thanks for any insight!

@pietersv
Copy link
Collaborator

@westwick Great question, if you can contact me directly it'd be great to have a thought partner to think through this. I'd like to develop this further but the conundrum is while there seems to be a market need to develop this branch of js-xlsx it may consist of exactly zero customers as there is a separate commercial branch for anyone with a budget.

@westwick
Copy link
Author

westwick commented Nov 30, 2018

sure will reach out

@jlbeard84
Copy link

+1 for being interested in further developments 👍

@donhmorris
Copy link

I would be interested in seeing this go further since getting the pro version is a clunky process.

I too was puzzled in how to use this package. I looks to me you use the original xlsx package to setup your sheets and then you render (write) with this package. That is what worked for me. I did find a bug in processing fills with a background color for cells. I'm modifying my local and may try to get my fix into the repo.

@jlbeard84
Copy link

@donhmorris I ended up forking another library and adding fills for background colors. It ended up being a little closer to my requirements.

https://github.com/jlbeard84/zipcelx if you're interested at all.

@donhmorris
Copy link

donhmorris commented Jan 11, 2019

@jlbeard84 Thanks for sharing.

My client wants to use excel as a report rendering engine with colors, headlines, groups, etc. In his domain they use excel to pass around information quite a bit.

If I get stuck I may setup a windows server in amazon light sail and use .net. I’ve used .net for creating custom excel workbooks before. The libraries and tools are really good for this in .net.

@pietersv
Copy link
Collaborator

@donhmorris This library supports background colors, etc, lots of examples in example_style.js. Try installing it from github directly (git install github:protobi/js-xlsx) rather than npm.

For what you're doing setting up a separate server shd not be necessary.

If all you're doing is creating Excel XLSX and you don't need to read XLSX, XLS or write XLSB files, then there a lots of node libraries to suport that. One very lightweight one is msexcelbuilder.
https://github.com/protobi/msexcel-builder.

@pietersv pietersv reopened this Jan 11, 2019
@pietersv
Copy link
Collaborator

pietersv commented Jan 11, 2019

this is #90

@donhmorris
Copy link

donhmorris commented Jan 11, 2019

I tried with rgb values and it paints in black every time.

I’m pretty sure I found a bug in the code. I’ll try github and I will also try using an indexed color with the theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants