Skip to content

#2331, #2332 - fix for combining EpplusTableColumn and Display attributes in LoadFromCollection.#2333

Merged
JanKallman merged 1 commit intodevelop8from
bug/i2331
Apr 15, 2026
Merged

#2331, #2332 - fix for combining EpplusTableColumn and Display attributes in LoadFromCollection.#2333
JanKallman merged 1 commit intodevelop8from
bug/i2331

Conversation

@swmal
Copy link
Copy Markdown
Contributor

@swmal swmal commented Apr 14, 2026

See #2331 and #2332

Fix: EpplusTableColumnAttribute and DisplayAttribute interop

Problem

When both EpplusTableColumnAttribute and DisplayAttribute were present on a property, two issues occurred:

  1. Column order: EpplusTableColumnAttribute.Order was ignored when DisplayAttribute was also present, because the else if chain in GetSortOrder always matched EpplusTableColumnAttribute first — even when Order was not explicitly set (default int.MaxValue), preventing fallback to DisplayAttribute.Order.

  2. Localized headers: DisplayAttribute.Name was used directly instead of DisplayAttribute.GetName(), causing resource keys to appear as column headers instead of localized values when ResourceType was set.

Changes

  • EpplusTableColumnAttributeBase: Added internal OrderIsSet flag, set in the Order property setter, to distinguish explicitly set values from the default.
  • SortOrderExtensions.GetSortOrder: Added OrderIsSet check so unset EpplusTableColumnAttribute.Order falls back to DisplayAttribute.Order.
  • MemberPath.GetHeader and LoadFromCollection<T>.GetHeaderFromDotNetAttributes: Changed displayAttr.Name to displayAttr.GetName() for correct resource localization.

Precedence rules

When both attributes are present: EpplusTableColumnAttribute wins for properties explicitly set, otherwise DisplayAttribute is used as fallback.

@swmal swmal self-assigned this Apr 14, 2026
@swmal swmal added bug Something isn't working enhancement New feature or request labels Apr 14, 2026
@JanKallman JanKallman merged commit 3995501 into develop8 Apr 15, 2026
3 checks passed
@github-project-automation github-project-automation bot moved this to Pending Release in Epplus Enhancements Apr 15, 2026
@JanKallman JanKallman deleted the bug/i2331 branch April 15, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Status: Pending Release

Development

Successfully merging this pull request may close these issues.

2 participants