当前位置: 首页 > news >正文

温岭市建设局网站审批公示网站流量检测

温岭市建设局网站审批公示,网站流量检测,长沙网页设计哪个公司好,唐山高端网站建设在初始化WordHelper时#xff0c;要获取模板的相对路径。获取文档的相对路径多个地方要用到#xff0c;比如批量导出时要先保存文件到指定路径下#xff0c;再压缩打包下载#xff0c;所以专门写了个关于获取文档的相对路径的类。 1 #region 获取文档的相对路径2 pub…     在初始化WordHelper时要获取模板的相对路径。获取文档的相对路径多个地方要用到比如批量导出时要先保存文件到指定路径下再压缩打包下载所以专门写了个关于获取文档的相对路径的类。  1 #region 获取文档的相对路径2 public class WordFilePath3 {4 #region 返回文件带路径值5 /// summary6 /// 返回文件带路径值7 /// /summary8 /// param nameFilePth文件所在文件夹名称/param9 /// param nameFileName文件名/param 10 /// returns/returns 11 public static string FileWithFilePath(string FilePth, string FileName null) 12 { 13 string strFile ; 14 if (!string.IsNullOrEmpty(FilePth)) 15 strFile ~/ FilePth /; 16 if (!string.IsNullOrEmpty(FileName)) 17 strFile FileName; 18 19 return strFile; 20 } 21 #endregion 22 23 #region 判断文件或文件夹是否存在 24 /// summary 25 /// 判断文件或文件夹是否存在 26 /// /summary 27 /// param nameFilePth文件所在文件夹名称/param 28 /// param nameFileName文件名/param 29 /// returns/returns 30 public static bool ExistFile(string FilePth, string FileName null) 31 { 32 return System.IO.File.Exists(GetFilePath(FilePth, FileName)); 33 } 34 #endregion 35 36 #region 获取文件及文件夹的相对路径 37 /// summary 38 /// 获取文件及文件夹的相对路径 39 /// /summary 40 /// param nameFilePth/param 41 /// param nameFileName/param 42 /// returns/returns 43 public static string GetFilePath(string FilePth, string FileName null) 44 { 45 string strPath ; 46 strPath FileWithFilePath(FilePth, FileName); 47 strPath HttpContext.Current.Request.MapPath(strPath); 48 return strPath; 49 } 50 #endregion 51 } 52 #endregion View Code      以上方法可以实现了单个word文档带图片的导出功能了多个文档的生成也可以实现只是还没有打包下载的代码。     最后调用的方法如下要先判断模板是否存在     1 string strpath Content/templates; //模板所在的文件文件夹2 string templateFile 实习生学习记录表导出模板.doc;3 if (WordFilePath.ExistFile(strpath, templateFile))4 {5 string saveName WordHelper.SaveDocName(form[NTName], form[CardNo]); //保存的名称6 saveName HttpUtility.UrlEncode(saveName, Encoding.GetEncoding(utf-8));7 WordHelper wordhelper new WordHelper(templateFile);8 getWordInfo(wordhelper, templateFile, NTID, stype.ToString(), majorid.ToString(), sequence.ToString());9 return base.File(wordhelper.ExportDoc().ToArray(), application/msword, saveName); 10 } 11 else 12 { 13 return ShowRedirectMessage(导出的模板不存在, strUrl); 14 } View Code     getWordInfo方法是为将所需的信息拼凑成一个word文档,减少代码的重复性而提取出来的如 1 #region 将所有信息拼凑成一个word文档2 public void getWordInfo(WordHelper wordhelper, string tempFile, string ntid, string stype, string mid, string sequence)3 {4 if (tempFile.Contains(实习生学习记录表导出模板))5 {6 Dictionarystring, string dicWhere new Dictionarystring, string();7 dicWhere.Add(NTID, ntid);8 wordhelper.GetBasicInfo(typeof(BLL.NewTraineeInfo), dicWhere);9 PrejobTrainWord(wordhelper, ntid); 10 TrainListWord(wordhelper, ntid, stype, mid); 11 AwardListWord(wordhelper, ntid, stype, mid); 12 ArrangeListWord(wordhelper, ntid, stype); 13 ScoreListWord(wordhelper, ntid, stype, mid, sequence); 14 EvalWord(wordhelper, ntid, stype, mid); 15 } 16 } 17 18 #region 其他信息 19 //岗前培训 20 public void PrejobTrainWord(WordHelper wordhelper, string ntid) 21 { 22 Dictionarystring, string dicWhere new Dictionarystring, string(); 23 dicWhere.Add(NTID, ntid); 24 wordhelper.GetBasicInfo(typeof(BLL.PrejobTraining), dicWhere); 25 } 26 27 //轮科安排表 28 public void ArrangeListWord(WordHelper wordhelper, string ntid, string stype) 29 { 30 Dictionarystring, string dicWhere new Dictionarystring, string(); 31 dicWhere new Dictionarystring, string(); 32 dicWhere.Add(NTID, ntid); 33 dicWhere.Add(StudentType, stype.ToString()); 34 wordhelper.GetTableList(typeof(BLL.MajorCycle), dicWhere, ArrangeList); 35 } View Code ArrangeList是之前在word模板里所设定的如下图用for循环出列表      getWordInfo里其它的方法类似这两个。          最后导出的word文档大致如下图所示                  转载于:https://www.cnblogs.com/jingshuisihan/p/4604294.html
http://wiki.neutronadmin.com/news/192242/

相关文章:

  • 推荐做pc端网站天眼企查查网官网
  • 长沙外贸建站thinkphp开发的网站
  • 网上自己建网站淘客做网站运营
  • 沈阳 建设工程 招标中心网站网络营销推广为什么效果不好
  • 学校网站建设开发项目计划报告一级门户网站建设费用
  • 网站建设完成大概多久出于安全保障需要
  • 网站如何做电脑和手机计算机培训机构一般多少钱
  • 快速搭建网站框架新手攻略免费外贸网站源码
  • 网站ui设计师培训企业为什么要做建站
  • 视频在线直播网站建设微信视频号可以推广吗
  • 模板网站做外贸好不好wordpress首页锚点
  • 张家界优秀网站建设网站建设需要注意哪些细节
  • 网站建设釒首先金手指十五做网站张家口
  • 网站管理助手4.0教程设计企业网站内容
  • 辽宁建设银行企业银行官方网站wordpress加载速度慢
  • 光明新区城市建设局网站数学wordpress博客
  • 长沙专业企业建站联系人西安做网站 怎样备案
  • 网站seo推广哪家值得信赖做图表用的网站
  • 专业网站优化电话同程网 网站模板
  • 泉州网站开发人员建设门户网站人均ip1000需要多大数据库
  • 株洲网站排名关键词优化多少钱
  • 做的网站如何全屏代码微网站开发的比较总结
  • 分类目录是什么意思看seo
  • 徐闻手机网站建设公司软件平台下载
  • 锦州做网站的公司seo公司运营
  • 企业网站建设费用怎么核算wordpress自建全屏页面
  • 给公司做宣传网站的好处报电子商务(网站建设与运营)
  • 保亭住房和城乡建设局网站如何在阿里云建设网站
  • 网站死链怎么办wordpress用户中心主题
  • 国内外婚纱网站建设现状网站的建设模式是指什么时候开始