-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: Excel exporter will now observe if numeric type has dollar form… #843
feat: Excel exporter will now observe if numeric type has dollar form… #843
Conversation
…atter. If it does, it will use the dollarFormatter stylesheet.
Codecov Report
@@ Coverage Diff @@
## master #843 +/- ##
===========================================
- Coverage 100.00% 99.97% -0.03%
===========================================
Files 239 239
Lines 16369 16377 +8
Branches 5776 5781 +5
===========================================
+ Hits 16369 16372 +3
- Misses 0 5 +5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
ok I see what you're trying to achieve, however I would prefer to do some refactoring and move all of that big switch case in a separate util file. Let me do that refactoring first and you can add the dollar formatters on top of my refactoring. The other reason I want to refactor is that you are missing unit tests and as it stands currently, it's not easy to add tests for them, so let me refactor first with easier way to add unit tests and you can add on top of it. I have to warn you though, you might have to redo your entire PR after my refactoring, I also do not want to lower my unit test coverage (I worked many months to get to 100%) Here's a preview of my refactoring A column with decimal formatter, which uses these option (see Common Formatter Options - Wiki) for currency with params like number prefix will now be interpreted my new refactoring and it stays as a valid number in Excel. I will do the decimal formatter only and you can add all the dollar formatters in a subsequent PR. this.columnDefinitions = [
{
id: 'cost', name: 'Cost', field: 'cost',
type: FieldType.number,
exportWithFormatter: false,
formatter: Formatters.decimal,
groupTotalsFormatter: GroupTotalFormatters.sumTotalsDollar,
params: { displayNegativeNumberWithParentheses: true, numberPrefix: '€ ', groupFormatterPrefix: '<b>Total</b>: ' /* , groupFormatterSuffix: ' USD' */ },
},
]; |
Not a problem, just let me know when your refactor is done. If I have to redo my PR, it's fine. It isn't a ton of code. Although, if I understand correctly, I may not need to add anything. I'll adjust your example above to work have a '$' instead. |
@austinsimpson
this will probably take a few days, but if I can get number 2., it would improve the performance and reduce download time EDIT Seems like number 2. is not possible, however the last PR I made improved Date format and isn't duplicating format anymore (it was prior to your PR and my latest PR). So anyway I can't seem to improve on that side but I'll be looking at number 3 and maybe add more format by field & format types. |
Hi @ghiscoding, Thanks for getting this merged in. let me know if you'd like me to tackle #3. I could likely do it over the weekend at some point. Also, when are you planning on releasing these changes? I'm trying to plan a release that depends on these changes. Thank you, |
I'm still working on number 2, it's a bit problematic for grid with Grouping which is what I'm currently trying to figure out the best way. I'll do number 3 after that. I will take me a few more days, but that's ok I'm in vacations already so, taking my time |
@austinsimpson this is now shipped in the new Slickgrid-Universal v2.2.0 and Angular-Slickgrid v5.2.0 releases Cheers and Happy Holidays ⭐ |
Hi @ghiscoding, thank you for getting this out. Enjoy your holidays! |
@austinsimpson I was curious, have you had a chance to try the new Excel export options? I'd be interested to know if the new options are helpful. Cheers |
Hi @ghiscoding, happy new year! Yes, I was able to use it, and it was very helpful. Thank you! |
Great thanks for the confirmation 😉 ⭐ |
Hi @ghiscoding, I have another PR for you. This PR will change the excel exporter to observe the columnDef's formatter on numeric data types. If a column has a dollar formatter associated with it, the export will choose the dollarFormatter stylesheet. I was having issues where excel would interpret currency as a string rather than a number, breaking the sum, avg, etc functions.