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

Source generator - Cell fill color #31

Open
Nemanja986 opened this issue Dec 27, 2023 · 4 comments
Open

Source generator - Cell fill color #31

Nemanja986 opened this issue Dec 27, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Nemanja986
Copy link

Is there a way to use cell styles attributes with source generator?
For example, I want to highlight specific property in my class:

public class MyObject
{
        [HighlightExcelCell('some color')]
        public string Property{ get; set; }
}
@sveinungf
Copy link
Owner

This is not supported yet. You want to have all cells in a column with the same color? Or would different rows have different styling?

@Nemanja986
Copy link
Author

Nemanja986 commented Dec 28, 2023

I would like to color a specific cell for now, meaning all cells in a column the same color, but it would be good if both options were available. Also, is it possible to limit the length of a value in a cell?

public class MyObject
{
        [[StringLength(30)]
        public string Property{ get; set; }
}

When can we expect version 1.13.0?

@sveinungf sveinungf changed the title Source generator Source generator - Cell fill color Dec 28, 2023
@sveinungf
Copy link
Owner

I would like to color a specific cell for now, meaning all cells in a column the same color, but it would be good if both options were available.

Having the same color for all cells in a column could be done with an attribute like you've suggested. Having different colors depending on the row is not that straight-forward with the use of an attribute. If you have an idea how that could look like then please let me know! I want to make sure there is a somewhat similar approach that could be used for both use cases before implementing the same-color use case.

Also, is it possible to limit the length of a value in a cell?

It's not currently possible, but I've created a separate issue to track this: #33

When can we expect version 1.13.0?

Most likely when #21 has been implemented. It is currently work-in-progress. No ETA to share at this time.

@Nemanja986
Copy link
Author

I agree that implementing different colors depending on the row isn't straight-forward. However, we could consider an attribute that colors the cell in a specific way based on the cell's value. For example, if the property is an integer and its value is greater than 20, I want to color that cell in red, something like that, thoughts?

In any case, these two attributes are quite okay for now (StringLength and HighlightExcelCell)

By the way, thank you for the quick response, and I must compliment you, excellent library.

@sveinungf sveinungf added the enhancement New feature or request label Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants