-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
如何把数字导出成文本? #23
Comments
把你的代码贴上来看看 |
[ExcelExporter]
class LongToStr
{
[ExporterHeader("Long",format:"@")]
public long Long { get; set; }
[ExporterHeader("String")]
public String Str => Long.ToString();
}
List<LongToStr> list = new List<LongToStr>();
for (long i = 9223372036854775797L; i > 9223372036854775787L; i--)
{
list.Add(new LongToStr(){Long = i});
}
ExcelExporter exporter = new ExcelExporter();
exporter.Export("test.xlsx", list); 我希望能让数字显示成字符串 = =。有什么方法吗? |
#,##0 |
[ExporterHeader(DisplayName = "长数值", Format = "#,##0")] |
如果暂不支持的话 将来能不能在 Attr 里面加个 type 什么的 让字段当字符串 处理 |
等我有空测试一下。 |
设置为“#”是OK的,但是如果数值过长的话,在写入的时候已经存在数据丢失,因此无论你如何设置格式,都是不对的。哪怕再将其转为文本类型。
后续可以考虑通过特性处理,或者提供数据筛选器。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Format 设置为什么 可以让 单元格 在导出后变成文本。
long 的 总变成 科学计数法
网上查了下 设成 @ 也没有用。。。
还是说最新版已经支持?
The text was updated successfully, but these errors were encountered: