-
Notifications
You must be signed in to change notification settings - Fork 90
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
Cell Styling #50
Comments
I think I'll err to the answer I've previously given, that features like these would be lovely. I think they should come in some kind of plugin structure, so consumers can still get a minimal bundle if they don't need anything else. The initial vision (which can definitely be challenges) was to create the smallest possible library to produce a valid xlsx file in the browser. |
I totally agree with the vision and actually I quite like the job that has been done here (it's impossible to get a non overkilling xlsx exporter library). Is there a roadmap to achieve a plugin hierarchy? Some proposal? I would love to contribute more to this. |
Not at all. It's not something I have personally pursued, so it would have to be a community effort 🙂 |
I see and understand your position regarding the smallest possible library. I think it might be shortsighted since without styling, formulae, multiple sheets or charts there is no reason to use this over a plain csv file. a simple solution: make a standard add-on syntax like this (add col definition to sheet object) |
@jphardman Reason is simple: MS Excel sucks at importing CSV. That's why we adopt zipcelx in my previous company.
I totally agree with it. The question is: how to make zipcelx modular. Because right now, we just return strings. Maybe instead of strings, we should use DOM Methods. This way we can add hooks for plugins. I.E: export generatorNumberCell (index, value, rowIndex) => (`<c r="${generatorCellNumber(index, rowIndex)}"><v>${value}</v></c>`); const generatorNumberCell = (index, value, rowIndex) => (`<c r="${generatorCellNumber(index, rowIndex)}"><v>${value}</v></c>`);
Become
const generatorNumberCell = (index, value, rowIndex) => {
const cell = document.createElement(c);
c.addAttribute('r', generatorNumberCell(index, rowIndex));
const cellValue = document.createElement(v);
v.innerText = value;
cell.appendChild(cellValue);
return cell;
} And then we can call cell hooks and pass to them the new Element. const cell = generatorNumberCell(a, b, c);
plugins.cell.forEach(plugin => plugin(cell)); ⚠ Please note that this is not a pure and functionnal way of doing things... so this could easily leads to unexpected problems. What do you think ? |
I gave it a thought for quite some time and never came with a proper solution for a plugin system were you could hook your functions (like adding color to cells, formulas etc etc). Your idea could be a first iteration at least @doliG |
Hello!
I was taking a look at the OpenXML format for styling at cell level or even at Table level. Nothing too powerful but at least allow a minimal amount of formatting (font styling / bgColor). I believe that this can increase the bundle size but not in a big scale. My question is more, What is the bundle size / minimum feature proportion to consider such a change?
Maybe we can define the feature:
Add solid background color.
Add font styling such as italic/bold/under
Add font alignment center/right(default)/left
I am doing a bit on work about this but I want to know if I should consider PR 😄
The text was updated successfully, but these errors were encountered: