protected void btn_CreatePDF_Click(object sender, EventArgs e) { string str_PdfFilename, str_mulu; string str_DocFilename; str_mulu = "./2015课题成果/研究报告/"; string str_MapPath = Server.MapPath(str_mulu); DirectoryInfo di = new DirectoryInfo(str_MapPath); FileInfo[] dis = di.GetFiles();//取目录中所有内容 for (int i = 0; i < dis.Length; i++) { str_DocFilename = dis[i].Name; str_PdfFilename = str_DocFilename.Substring(0, str_DocFilename.LastIndexOf(".")) + ".pdf"; try { Microsoft.Office.Interop.Word.WdSaveFormat wdf = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF; WordToal.Word2Format(str_MapPath + str_DocFilename, str_MapPath + str_PdfFilename, wdf); } catch (Exception ee) { CommFun.error_record(Session["jsh"].ToString(), Session["jsm"].ToString(), ee.Message); } } }
protected void bindData() { str_sql = "SELECT Status,sqr,xmbh,zqbg_dName,zqbg from t_teacher_list where appNo = '" + Session["appNo"].ToString() + "';"; DataRow dr = DBFun.GetDataRow(str_sql); if (dr == null) { return; } string str_status = dr["Status"].ToString(); cbx_1.Checked = (str_status == "6"); string str_sqr = dr["sqr"].ToString(); string str_xmbh = dr["xmbh"].ToString(); string str_DocFilename = dr["zqbg"].ToString(); string str_HtmlFilename, str_mulu; str_mulu = "./中期检查申请表/"; if (str_DocFilename == "") { Response.Write("<script>alert('尚未上传期中检查申请表!');</script>"); hl_1.ForeColor = System.Drawing.Color.Red; hl_1.Text = "尚未上传期中检查申请表"; hl_1.NavigateUrl = ""; return; } str_HtmlFilename = str_DocFilename.Substring(0, str_DocFilename.LastIndexOf(".")) + ".pdf"; string str_MapPath = Server.MapPath(str_mulu); //if (!File.Exists(str_MapPath + str_filename)) //{ // Response.Write("<script>alert('尚未上传期中检查申请表!');</script>"); // return; //} //File.Copy(str_MapPath + str_filename, str_MapPath + str_newfilename, true); hl_1.ForeColor = System.Drawing.Color.FromArgb(000066); hl_1.Text = "查看中级检查申请表"; //string str_oldfilename = Server.MapPath(str_filename + ".doc"); try { word.WdSaveFormat wdf = word.WdSaveFormat.wdFormatPDF; WordToal.Word2Format(str_MapPath + str_DocFilename, str_MapPath + str_HtmlFilename, wdf); } catch { } hl_1.NavigateUrl = str_mulu + str_HtmlFilename; }
protected void bindData() { str_sql = "SELECT sqr,xmbh,rws_dName,rws from t_teacher_list where xmbh = '" + Session["xmbh"].ToString() + "';"; DataRow dr = DBFun.GetDataRow(str_sql); if (dr == null) { return; } string str_sqr = dr["sqr"].ToString(); string str_xmbh = dr["xmbh"].ToString(); string str_DocFilename = dr["rws"].ToString(); string str_HtmlFilename, str_mulu; str_mulu = "./任务书/"; if (str_DocFilename == "") { Response.Write("<script>alert('尚未上传期任务书!');</script>"); hl_1.ForeColor = System.Drawing.Color.Tomato; hl_1.Text = "尚未上传期任务书"; hl_1.NavigateUrl = ""; return; } str_HtmlFilename = str_DocFilename.Substring(0, str_DocFilename.LastIndexOf(".")) + ".pdf"; string str_MapPath = Server.MapPath(str_mulu); hl_1.ForeColor = System.Drawing.Color.FromArgb(000066); hl_1.Text = "查看任务书"; try { word.WdSaveFormat wdf = word.WdSaveFormat.wdFormatPDF; WordToal.Word2Format(str_MapPath + str_DocFilename, str_MapPath + str_HtmlFilename, wdf); } catch (Exception e) { CommFun.error_record(Session["jsh"].ToString(), Session["jsm"].ToString(), e.Message); return; } hl_1.NavigateUrl = str_mulu + str_HtmlFilename; }