https://www.cnblogs.com/sun1630/p/5534754.html
修改部分(根据使用的excel版本,生成excel):
string Version;//excel版本号
int FormatNum;//保存excel文件的格式
Version = m_xlApp.Version;//获取使用的excel 的版本号
if (Convert.ToDouble(Version) < 12)//You use Excel 97-2003
{
FormatNum = -4143;
}
else//you use excel 2007 or later
{
FormatNum = 56;
}
workbook.SaveAs(filePath, FormatNum);