Skip to content

feat(DynamicExcelColumn): make the CustomFormatter property more powerful - #715

Merged
shps951023 merged 3 commits into
mini-software:masterfrom
izanhzh:feat-custom-formatter
Jan 23, 2025
Merged

feat(DynamicExcelColumn): make the CustomFormatter property more powerful#715
shps951023 merged 3 commits into
mini-software:masterfrom
izanhzh:feat-custom-formatter

Conversation

@izanhzh

@izanhzh izanhzh commented Jan 23, 2025

Copy link
Copy Markdown
Member

close: #708

我注意到,在此前的PR #700 中,DynamicExcelColumn增加了一个属性:

public Func<object, string> CustomFormatter { get; set; }

PR #700 存在一些问题,假设我原来的值是数字类型,因为这里返回的值是string类型,并且因为调用CustomFormatter委托时机问题,导致最终生成的Excel单元格设置是数字但实际值非数字,Excel打开报错,例如,我想对金额加一个币别符号1 -> $1

我进行了一些优化,调整为 Func<object, object>,可以避免此问题

@izanhzh
izanhzh requested a review from shps951023 January 23, 2025 03:39
@shps951023
shps951023 merged commit 2e7219c into mini-software:master Jan 23, 2025
@izanhzh
izanhzh deleted the feat-custom-formatter branch February 6, 2025 00:19
pull Bot pushed a commit to zilo555/MiniExcel that referenced this pull request Aug 29, 2026
…rful (mini-software#715)

* feat(DynamicExcelColumn): make the `CustomFormatter` property more powerful

* support `IEnumerable` data
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

Successfully merging this pull request may close these issues.

写文件时,对格式化数据的支持

2 participants