dotnetcore / dotnetcore/Magicodes.IE

Excel导出,Long类型改成文本导出,内容依然是科学计数法文本

Open
#520 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.2k
Forks
495
PR merge metrics
No merged PRs in 30d

Description

### Expected behaviour

因为不想另起一行string属性,希望能直接将long的属性,转为文本输出,不要科学计数法

### Actual behaviour
样式确实转成了文本,但是内容还是科学计数法
![1689918673168](https://github.com/dotnetcore/Magicodes.IE/assets/40768649/5ebbce5a-fbef-436f-996b-6e41a5bb9015)

#### package versions
Example: Magicodes.IE.Excel 2.7.4.2

### So how can we reproduce this?

```
[ExcelExporter(Name = "中文表名", TableStyle = TableStyles.Medium10)]
public class ExportModelTest3
{
///
/// 会不会转成科学计数法
///
public long CountLong { get; set; }
///
/// 会不会转成科学计数法
///
[ExporterHeader(DisplayName = "不转科学计数法", Format = "@")]
public long CountLong2 => CountLong;
}
```
```
[Fact]
public async Task ExcelExporter_标准导出()
{
//这个只是模拟数据
List dto = GetMockList();
IExcelExporter exporter = new ExcelExporter();
var data = await exporter.ExportAsByteArray(dto);
var filePath = Path.Combine("d:\\Documents\\测试数据", $"导出_{DateTime.Now:MMddHHmmss}.xlsx");
Console.WriteLine($"filePath:{filePath}");
File.WriteAllBytes(filePath, data);
Assert.True(File.Exists(filePath));

}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.