var row = new List<Dto>()
{
new Dto() {Name = "Bill",UserType = Type.V1},
new Dto() {Name = "Bob",UserType = Type.V2}
};
var value = new { t = row };
MiniExcel.SaveAsByTemplate(@"C:\Users\User\Desktop\测试\MiniExcel\result.xlsx", @"C:\Users\User\Desktop\测试\MiniExcel\template.xlsx", value);
public class Dto
{
public string Name { get; set; }
public Type UserType { get; set; }
}
public enum Type
{
[Description("General User")]
V1,
[Description("General Administrator")]
V2,
[Description("Super Administrator")]
V3
}
Excel Type
Upload Excel File
Please attach your issue file by dragging or droppng, selecting or pasting them.
e.g : https://github.com/shps951023/MiniExcel/files/6538107/demo.xlsx
MiniExcel Version
1.31.2
Description
IEnumerable 数据填充模板时,如果数据类型中包含枚举,则渲染生成的xlsx文件Excel会提示部分内容有问题。 测试用例源码如下(LinqPad C# Statements):
渲染模板: template.xlsx 运行结果: result.xlsx
用Excel打开运行结果,出现如下提示:
XML文件内容如下: error242080_01.zip