前提:NuGet
安装EPPlus
,选择合适的能兼容当前.net framwork
的版本
主要代码:
private void btn_export_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Excel Files|*.xlsx|All Files|*.*"; // 设置文件筛选器
saveFileDialog.Title = "选择保存位置"; // 设置对话框标题
saveFileDialog.FileName = "data.csv"; // 设置默认文件名
if (saveFileDialog.ShowDialog</