public static void CreateJobRequestWord(DataTable JobRequest, bool IsSharpZip) { string fileName = ""; var docStream = new MemoryStream(); string uploadFilePath = WebUtil.Instance.AppPath() + AppSettingUtil.AppSettings["UploadFilePath"]; string tempPath = HttpContext.Current.Server.MapPath(uploadFilePath + "WordTemplate/Temp.doc"); string folderName = DateTime.Now.ToString("yyyyMMddHHmmssms"); string outputPath = HttpContext.Current.Server.MapPath(uploadFilePath + "jobrequest/" + folderName); if (JobRequest.Rows.Count == 0) { return; } if (IsSharpZip) { fileName = DateTime.Now.ToString("yyyyMMddHHmmssms") + ".zip"; } else { fileName = JobRequest.Rows[0]["Name"].ToStr() + "_" + JobRequest.Rows[0]["IDCardNo"].ToStr() + "_" + JobRequest.Rows[0]["Whir_U_Jobs_JobRequest_PID"].ToStr() + ".doc"; } //增加岗位名称 JobRequest.Columns.Add("JobName", typeof(string)); foreach (DataRow dr in JobRequest.Rows) { docStream = new MemoryStream(); string name = dr["Name"].ToStr() + "_" + dr["IDCardNo"].ToStr() + "_" + dr["Whir_U_Jobs_JobRequest_PID"].ToStr() + ".doc"; var JobName = DbHelper.CurrentDb.ExecuteScalar("select JobName from Whir_U_Jobs where Whir_U_Jobs_PID=@0 and isdel=0", dr["JobID"]).ToStr(); dr["JobName"] = JobName;
int JobRequestId = dr["Whir_U_Jobs_JobRequest_PID"].ToInt(0);
DataTable dtFamily = DbHelper.CurrentDb.Query("select * from Whir_U_Jobs_JobRequest_Family where isdel=0 and JobRequestId=@0", JobRequestId).Tables[0]; dtFamily.TableName = "Family";
DataTable dtLearning = DbHelper.CurrentDb.Query("select * from Whir_U_Jobs_JobRequest_learning where isdel=0 and JobRequestId=@0", JobRequestId).Tables[0]; dtLearning.TableName = "Learning";
DataTable dtSpecialty = DbHelper.CurrentDb.Query("select *,convert(varchar(10),WinningTime,21) as WinningTimeTemp from Whir_U_Jobs_JobRequest_Specialty where isdel=0 and JobRequestId=@0", JobRequestId).Tables[0]; dtSpecialty.TableName = "Specialty";
DataTable dtWorking = DbHelper.CurrentDb.Query("select *,StartEndDate as WorkStartEndDate,Duties as WorkDuties from Whir_U_Jobs_JobRequest_Working where isdel=0 and JobRequestId=@0", JobRequestId).Tables[0]; dtWorking.TableName = "Working";
//---------------------------------------------------------------------------------------------------- var doc = new Document(tempPath); //头像 DocumentBuilder builder = new DocumentBuilder(doc); builder.MoveToBookmark("Avatar"); try { builder.InsertImage(HttpContext.Current.Server.MapPath(uploadFilePath + dr["Avatar"].ToStr()), 100, 130); } catch (Exception ex) {