public bool createexcel(int id) { ScanInfoBLL scanbll = new ScanInfoBLL(); SqlDataReader sr = scanbll.GetItemsById(id); string title = ""; string firstitem = ""; string seconditem = ""; string thirditem = ""; string forthitem = ""; string fifthitem = ""; while (sr.Read()) { title = sr[1].ToString(); firstitem = sr[2].ToString(); seconditem = sr[9].ToString(); thirditem = sr[16].ToString(); forthitem = sr[23].ToString(); fifthitem = sr[30].ToString(); break; } sr.Close(); DataTable dt = bll.GetTable(); DateTime date = DateTime.Now; string Title = title + date.ToShortDateString() + "打印"; string path = Server.MapPath("./file//排行榜.xlsx"); return(bll.createlist(dt, Title, firstitem, seconditem, thirditem, forthitem, fifthitem, path)); }