Closed rogerospina closed 4 years ago
Hey @rogerospina thanks for writing. You are always welcome to contribute.
By the way what do you mean by including or excluding a property? Can you describe more about this use case? Because the simple way to exclude a property is to not have it in the Final Excel Model. Excel Model is specific to excel creation and not advised to use for any other purpose/use. Please can you write more about this idea? I would be happy to hear.
Thanks, Abdul
Hi @fingers10 thanks to you for your excellent and helpfull development.
This is what I mean: In my case I have a view (printed in a table) with pagination, filters and other stuff. According to this View, I made the option to Export (with yours classes) the default view or current applied filter to an excel file.
My class ViewModel is the same for the table (what is showed in screen) and for the Excel file. For some reasons not all properties are showed, however they have some special tasks, depending each of them. So I didn't want to make another class ViewModel only for the Excel file, because I'd be duplicating code and I couldn't delete any property either.
So this is my idea → I created a custom attribute class for properties, to explicitly set if a property should be include in the Excel file or not. And if this attribute doesn't set, it'd be ok, the default value would be "true".
Something like this →
[IncludeInReport(false)] public int? UserId { get; set; }
What do you think ?
Thanks
feel free to submit your idea as PR. I'll review and merge
Hi @fingers10 I can't submit any changes, or create a branch, I don't have permissions to do it. Or what do you mean "as PR"?
@rogerospina PR means Pull Request. Follow the below steps.
A little bit of googling should help you.
I have merged your PR. Many Thanks @rogerospina .
Hi Abdul, I added an improvement to discriminate if a property must be included in the report or not. Can I contribute it in your Github project?