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

Nested columns output in wrong order #1167

Closed
grosch-intl opened this issue Nov 18, 2023 · 2 comments
Closed

Nested columns output in wrong order #1167

grosch-intl opened this issue Nov 18, 2023 · 2 comments
Assignees

Comments

@grosch-intl
Copy link

Sorry if this lives somewhere else, but I'm not seeing it on the existing ticket. This is a much higher priority for me than the other enhancements you're working on for me.

I need nested columns to appear in the "correct" order. In the below example, Foo is first and Baz is last, but for the employee, it does not appear in the order of Id, then Name, then EmailLink.

[EPPlusTableColumnSortOrder(Properties = new string [] { nameof(Foo), nameof(Owner), nameof(Baz) }]
class Outer {
   [EpplusTableColumn(Header = "Foo")]
   public string Foo { get; set; }

   [EpplusNestedTableColumn(HeaderPrefix = "Space Manager")]
   public EmployeeDTO Owner { get; set; }

   [EpplusTableColumn(Header = "Foo")]
   public string Foo { get; set; }
}

[EPPlusTableColumnSortOrder(Properties = new string[] {nameof(Id), nameof(Name), nameof(EmailLink) })
]
public class EmployeeDTO {
    [EpplusIgnore]
    public required bool Active { get; init; }

    [EpplusIgnore]
    public required string? Email { get; init; }

    [EpplusTableColumn(Header = "Email"), JsonIgnore, Ignore]
    public ExcelHyperLink? EmailLink {
        get {
            if (Email is null)
                return null;

            return new ExcelHyperLink($"mailto:{Email}") {
                Display = Email
            };
        }
    }

    [EpplusTableColumn(Header = "WWID")]
    public required int Id { get; init; }

    [EpplusTableColumn(Header = "Name")]
    public required string? Name { get; init; }
}
@swmal swmal self-assigned this Nov 20, 2023
@swmal
Copy link
Contributor

swmal commented Nov 20, 2023

Edit: This "lived" in #946 (comment)

I have added these to the common issue #1058

Will start working on this in parallel with the dictionary piece.

@grosch-intl
Copy link
Author

Thanks. I was going to reply telling you why that didn't work and then it finally clicked in my brain you said STRING, so I put "Owner.Name" instead of the non-valid nameof(Owner.Name) :)

This is a good workaround for me until there's full support, and keeps me from getting 100 tickets on Wednesday when I release this tool. Thanks!

swmal added a commit that referenced this issue Nov 21, 2023
swmal added a commit that referenced this issue Nov 21, 2023
JanKallman pushed a commit that referenced this issue Nov 22, 2023
JanKallman pushed a commit that referenced this issue Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants