我有这个代码,但它保存到文件中
Excel.Application app = new Excel.Application();
app.Workbooks.Add();
Excel._Worksheet sheet = app.ActiveSheet;
sheet.Cells[1, "A"] = "login";
sheet.Cells[1, "B"] = "e-mail";
int row = 1;
foreach (ProviderUser u in users)
{
row++;
sheet.Cells[row, "A"] = u.UserName;
sheet.Cells[row, "A"] = u.Email;
}
string pathToSave = Path.Combine(Environment.CurrentDirectory, "users.xlsx");
sheet.SaveAs(pathToSave);
app.Quit();