miniexcel C# 开发备忘

导出excel,设置列宽度:

var config = new OpenXmlConfiguration
{
    DynamicColumns = new DynamicExcelColumn[] { 
        new DynamicExcelColumn("id"){Ignore=true},
        new DynamicExcelColumn("name"){Index=1,Width=10},
        new DynamicExcelColumn("createdate"){Index=0,Format="yyyy-MM-dd",Width=15},
        new DynamicExcelColumn("point"){Index=2,Name="Account Point"},
    }
};
var path = PathHelper.GetTempPath();
var value = new[] { new { id = 1, name = "Jack", createdate = new DateTime(2022, 04, 12) ,point = 123.456} };
MiniExcel.SaveAs(path, value, configuration: config);

参考

https://gitee.com/dotnetchina/MiniExcel

https://www.dongchuanmin.com/net/3930.html

winform控件 datagridview

扩展

https://easyexcel.opensource.alibaba.com java excel 阿里巴巴开源

阅读剩余
THE END