回复 1楼jeremylhj的帖子
需要先上传Excel文件到服务器,关键代码:
- protected void Button3_Click(object sender, EventArgs e)
- {
- HttpPostedFile file = Request.Files["myFile"];
- if (file != null && file.ContentLength != 0)
- {
- string fname = Server.MapPath(Path.Combine("~/samples/ExcelCompatibility", Path.GetFileName(file.FileName)));
- // post file to application folder first (to avoid "Error Opening File" exception since the file is being used also by browser)
- file.SaveAs(fname);
- // open the posted Excel file
- OpenExcelFile(fname);
- }
- }
复制代码
Demo:
http://demos.componentone.com/sp ... ility/Overview.aspx |