-
-
Notifications
You must be signed in to change notification settings - Fork 250
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
Implement per cell styling for openspout #359
Implement per cell styling for openspout #359
Conversation
Hi @rap2hpoutre! Is there anything I can do to aid you in reviewing this PR? Please let me know if you need further explanation! |
Hi @rap2hpoutre, gentle reminder and honest question: Is this package still being maintained? |
Hi @jschram Can't wait to test this! |
Hi @potsky
Not quite sure, but I can't see why it wouldn't support multiple sheets. I've changed the way the rows are generated so you can provide an array with styles per column. As long as these column styles match for all sheets, I think you'll be fine. When those have to differ, I think it might need some more work. Could you test it out and let me know if it does indeed work? |
Yep I will test your PR. (new FastExcel(clone $collection))
->setColumnStyles([
0 => (new Style())->setFormat('mm/dd/yyyy'),
], $sheetIndex)
->export($file); I can make a PR on your PR if you want me to add this, just let me know! |
Awesome, thanks!
Sounds good. Yeah, the |
@jschram it works! |
Glad to hear, thanks a lot for testing! |
So with all checks having passed, and a successful manual test, maybe this PR can be merged now, @rap2hpoutre? 🙏 Would be really great if I can use this change from your repository for my project instead of relying on my fork. |
Oops, I am really sorry for the super late answer! Thank you for this addition 🙏 🙏 , I juste merged it! I will release it right after. |
Available in v5.5.0. Thank you for your patience! |
No problem, sometimes life just happens. Don't worry about the delay 👍 |
It would be nice to be able to format certain values as numeric, date, etc.
To achieve this, DateTime values should be accepted as well, from within
Exportable::transformRows
. There already is support in openspout for DateTime values (see: Writer\XLSX\Manager\WorksheetManager). So, I've made a contribution to openspout/openspout that allows a full Row to be created from an array with styling per cell. This was merged today and a new version has been tagged. See: openspout/openspout#235This PR implements this change, allowing users to set the formatting of certain columns (based on their numeric index) when exporting data.
For instance: