示例#1
0
        protected void btnRowInfoExport_Click(object sender, EventArgs e)
        {
            try
            {
                List <int> IDs = this.Master.GetSelectedIds(this.grdvClaimInfo);
                if (IDs.Count != 1)
                {
                    base.ShowMessage("请选择一行记录");
                    return;
                }


                string fileName = string.Format("ClaimInfo_{0}.doc", DateTime.Now.ToString("yy-MM-dd-HH-mm-ss-fff"));
                string filePath = string.Format("{0}Upload\\ClaimInfo", HttpContext.Current.Request.PhysicalApplicationPath);
                if (Directory.Exists(filePath) == false)//如果不存在就创建file文件夹
                {
                    Directory.CreateDirectory(filePath);
                }
                filePath = filePath + "\\" + fileName;


                ExportManager.ExportClaimInfoDocx(filePath, IDs[0]);
                CommonHelper.WriteResponseXls(filePath, fileName);
            }
            catch (Exception exc)
            {
                ProcessException(exc);
            }
        }