国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

歡迎使用CSDN-markdown編輯器

2019-11-06 07:18:43
字體:
供稿:網(wǎng)友
<form id="fm" method="post" enctype="mult模板編號(hào): </td> <td> <select id="drpMobanbianhao" class="easyui-combobox" style="width: 150px;" required="true" panelheight="auto" runat="server"> </select> </td> <td class="tb_left"> 模板名稱: </td> <td> <input id="txtSTempName" class="easyui-textbox" required="true" /> </td> </tr> <tr> <%--<td class="tb_left"> 是否必填: </td> <td> <input type="radio" class="radio" name="RidCMandatory" style="width: 25px;" value="0" checked="checked" /><label style="display: inline-block; height: 17px;">否</label> <input type="radio" class="radio" name="RidCMandatory" style="width: 25px;" value="1" /><label style="display: inline-block; height: 17px;">是</label> </td>--%> <td class="tb_left"> 文件: </td> <td> <div id="isShow"> <a id="linFileUrl" href="#" onclick="DownLoad()">下載模板</a> </div> </td> <td class="tb_left"> 文件名稱: </td> <td> <input id="txtSFileName" class="easyui-textbox" required="true" /> </td> <td class="tb_left"> 文件類型: </td> <td> <input id="txtSFileType" class="easyui-textbox" required="true" /> </td> </tr> <tr> <td class="tb_left"> 上傳模板: </td> <td colspan="3"> <input id="txtUploadMB" name="txtSFileUnit" class="easyui-filebox" required="true" data-options="["Random"] %>&flag=VariType' } }"> 變量類型 </th> <th data-options="field:'SVariName',width:280,align:'left',editor:'textbox'"> 變量名 </th> <th data-options="field:'SVariCnName',width:280,align:'left',editor:'textbox'"> 中文名 </th> <th data-options="field:'SVariWdTableName',width:80"> 對(duì)應(yīng)文檔表格名稱 </th> <th data-options="field:'SVariWdTableOrder',width:580,align:'left',editor:'textbox'" hidden="true"> 對(duì)應(yīng)文檔表格下標(biāo) </th> <th data-options="field:'SVariCoName',width:100, formatter:function(value,row){ return row.tableNameComment; }, editor:{ type:'combobox', options:{ valueField:'SVariCoName', textField:'tableNameComment', method:'get', url: '/Handler/SysMod/Docunmen.ashx/ProcessRequest?random=<%=Session["Random"] %>&flag=QueryTableInfoList', onSelect: GetValue } }"> 源名稱 </th> <th data-options="field:'NVariCoType',width:100, formatter:function(value,row){ return row.NVariCoName; }, editor:{ type:'combobox', options:{ valueField:'NVariCoType', textField:'NVariCoName', method:'get', url: '/Handler/SysMod/Docunmen.ashx/ProcessRequest?random=<%=Session["Random"] %>&flag=MajorOrSub' } }"> 源類型 </th> <th data-options="field:'SVariColumn',width:100, formatter:function(value,row){ return row.SVariCoCommonets; }, editor:{ type:'combobox', options:{ valueField:'SVariColumn', textField:'SVariCoCommonets', method:'get' } }"> 字段名 </th> </tr> </thead> </table> </div> </div> <%--在這里將變量列表體現(xiàn)出來--%> </form>

<td class="tb_left"> 上傳模板: </td> <td colspan="3"> <input id="txtUploadMB" name="txtSFileUnit" class="easyui-filebox" required="true" data-options="prompt:'選擇文件...',buttonText:'選擇文件',onChange:function(){uploadFiles()}" style="width: 370px;" /> </td>//這里是前臺(tái)頁面使用easyui實(shí)現(xiàn)的功能,需要引用easyui文件 function uploadFiles() { $('#fm').form('submit', { url: '/Handler/SysMod/Docunmen.ashx/ProcessRequest?Ran=' + Math.random() + '&flag=UploadFile', success: function (result) { var result = eval('(' + result + ')'); //可以寫一些提示的代碼等等.. $("#dd").datagrid({ rownumbers: true, data: result, pageSize: 10, height: 500, onEndEdit: onEndEdit, singleSelect: true, //單選 method: 'get', striped: true, fit: true, onClickCell: onClickCell }); } }); }`` //在這里是實(shí)現(xiàn)的具體方法 //在一般處理性程序頁面中 public void ProcessRequest(HttpContext context) { if (context.Request[“flag”] == “UploadFile”) { UploadFile(context); } }

private void UploadFile(HttpContext context) { context.Response.ContentType = "text/plain"; int length = context.Request.Files.Count; HttpFileCollection files = context.Request.Files; if (files.Count > 0) { for (int i = 0; i < files.Count; i++) { HttpPostedFile file = files[i]; if (file.ContentLength > 0) { //全路徑 string FullFullName = file.FileName; FileName = FullFullName; //獲取名稱 string sPt = context.Request.applicationPath + FileName; file.SaveAs(sPt); String fileName = FullFullName.Substring(FullFullName.LastIndexOf("http://") + 1); string path = "UploadFile"; fileName = Guid.NewGuid().ToString() + fileName;//防重名 SaveFileName = fileName; Stream requestStream = null; Stream fileStream = null; FtpWebResponse uploadResponse = null;//創(chuàng)建FtpWebResponse實(shí)例uploadResponse try { //獲取文件長度 int FileLength = file.ContentLength; FtpWebRequest uploadRequest = createFtpWebRequest(fileName); uploadRequest.Method = WebRequestMethods.Ftp.UploadFile;//將FtpWebRequest屬性設(shè)置為上傳文件 requestStream = uploadRequest.GetRequestStream();//獲得用于上傳FTP的流 byte[] buffer = new byte[FileLength]; fileStream = file.InputStream;//截取FileUpload1獲取的文件流,作為上傳FTP的流 fileStream.Read(buffer, 0, FileLength); requestStream.Write(buffer, 0, FileLength);//將buffer寫入流 requestStream.Close(); uploadResponse = (FtpWebResponse)uploadRequest.GetResponse();//返回FTP服務(wù)器響應(yīng),上傳完成 //上傳成功 } catch (Exception ex) { string s = ex.Message.ToString(); context.Response.Write(s.Substring(0, s.Length - 4) + "/n請(qǐng)聯(lián)系管理員!"); context.Response.End(); return; } finally { if (uploadResponse != null) uploadResponse.Close(); if (fileStream != null) fileStream.Close(); if (requestStream != null) requestStream.Close(); } //if (!Directory.Exists(System.Web.HttpContext.Current.Server.MapPath(path))) //{ // Directory.CreateDirectory(System.Web.HttpContext.Current.Server.MapPath(path)); //} ////保存文件。 //file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(path) + "http://" + fileName); //FileName = System.Web.HttpContext.Current.Server.MapPath(path) + "http://" + fileName; #region 讀取文檔中的內(nèi)容 List<ModelPmVariable> variablList = new List<ModelPmVariable>(); #region 讀取單一值 //string str="$fdddd$"; //var docum = copyWordDoc(FileName); var docum = new aspose.Words.Document(sPt); string[] str = docum.Range.Text.Split(' '); string pattern = @"^/$.*/$$"; foreach (var item in str) { Regex regex = new Regex(pattern, RegexOptions.Singleline); if (regex.IsMatch(item.Replace("/r", "").Replace("/n", ""))) { ModelPmVariable mbv = new ModelPmVariable(); mbv.SVariName = regex.Match(item).Value; mbv.NVariType = "1"; mbv.NVariName = "單一值"; variablList.Add(mbv); } } variablList = variablList.Where((x, j) => variablList.FindIndex(z => z.SVariName == x.SVariName) == j).ToList(); #endregion #region 讀取表格變量 doc = new Document(sPt); string result = Read();//這里是讀取表格中的變量 if (!string.IsNullOrEmpty(result)) { string[] strtb = result.TrimEnd('&').Split('&'); foreach (var item in strtb) { ModelPmVariable mbv = new ModelPmVariable(); mbv.SVariWdTableOrder = Convert.ToInt32(item.Replace("/r", "").Replace("/n", "").Split(';')[0].Split('+')[0]); mbv.SVariWdTableName = item.Replace("/r", "").Replace("/n", "").Split(';')[0].Split('+')[1]; mbv.SVariName = item.Replace("/r", "").Replace("/n", "").Split(';')[1]; mbv.NVariType = "2"; mbv.NVariName = "表格"; variablList.Add(mbv); } } #endregion //System.IO.Directory.Delete(sPt);//將服務(wù)器文件刪除 var sbJson = com.json(variablList, variablList.Count); context.Response.Write(sbJson.ToString()); context.Response.End(); #endregion } } } }```在這里可以下載Aspose

http://download.csdn.net/detail/airforcetwo/9770778


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 周口市| 龙海市| 彝良县| 弥勒县| 韩城市| 双流县| 阳山县| 清远市| 玉田县| 海盐县| 阳信县| 崇信县| 阿合奇县| 朝阳县| 育儿| 黎城县| 丹巴县| 扎鲁特旗| 年辖:市辖区| 通化县| 安庆市| 绵竹市| 军事| 桦川县| 灵山县| 湾仔区| 玉山县| 汨罗市| 白沙| 张北县| 通海县| 宁都县| 旬邑县| 大理市| 南涧| 英吉沙县| 得荣县| 吐鲁番市| 阳泉市| 女性| 延川县|