咨询区 mistrmark:我的一个项目中有导出 excel 的功能,但我发现运行代码的机器上一定要安装 Excel,否则就找不到 Microsoft.Office.Interop.Excel ,导致运行报错,请问如何解决?回答区 Mike Webb:你可以在 nuget 上找一下 ExcelLibrary 包,它是免费开源的,参考如下代码://Create the data set and tableDataSet ds = new DataSet("New_DataSet");DataTable dt = new DataTable("New_DataTable");//Set the locale for eachds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;dt.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;//Open a DB connection (in this example with OleDB)OleDbConnection con = new OleDbConnection(dbConnectionString);con.Open();//Create a query and fill the data table with the data from the DBstring sql = "SELECT Whatever FROM M
………………………………