导入word事件

 /// <summary>/// 导入word事件/// </summary>/// <param name="sender"></param>/// <param name="e"></param>protected void btuDaoWord_ServerClick(object sender, EventArgs e){StringBuilder html = new StringBuilder();TenderNoticeEntity etyTenderNotice = new TenderNoticeEntity();etyTenderNotice = _busTenderNotice.SearchId(hdCID.Value);if (etyTenderNotice != null){html.Append(@"<html><head><style>.t1{background:URL('" + System.Configuration.ConfigurationManager.AppSettings.Get("ImgFilePath").ToString() + @"/images/shuiyin.png');position:absolute;filter:alpha(opacity=10);z-index:1; width:100%; height:100%}.t2{z-index:2; width:100%; height:100%;position:absolute}.table7{font-size:14pt;border-top: 1px solid #000000;border-left: 1px solid #000000;}.table7 th{font-size:14pt;font-weight:lighter ;}.tabletd{font-size:14pt;border-bottom: 1px solid #000000;border-left: 1px solid #000000;border-top: 1px solid #000000;border-right: 1px solid #000000;padding-left:5px;padding-right:5px;}#gvContractDetail{border-top: 1px solid #000000;border-left: 1px solid #000000;border-bottom: 1px solid #000000;border-right: 1px solid #000000;}#gvContractDetail th{border-top: 1px solid #000000;border-left: 1px solid #000000;border-right: 1px solid #000000;line-height: 50px;font-weight:lighter ;}#gvContractDetail td{border-top: 1px solid #000000;border-left: 1px solid #000000;line-height: 50px;}.p1{margin: 0px;padding: 0px;height: 25px;line-height: 50px;font-size:14pt;}<!--@page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page WordSection1{size:841.9pt 595.3pt;mso-page-orientation:landscape;margin:89.85pt 72.0pt 89.85pt 72.0pt;mso-header-margin:42.55pt;mso-footer-margin:49.6pt;mso-paper-source:0;layout-grid:15.6pt;}div.WordSection1{page:WordSection1;}--></style></head><body style=""background:URL('" + System.Configuration.ConfigurationManager.AppSettings.Get("ImgFilePath").ToString() + @"/images/shuiyin2.png');position:absolute;""><div class=""t1""></div><div class=""WordSection1""><table cellspacing=""4"" cellpadding=""0"" width=""100%"" Height=""100%"" align=""center"" border=""0""><tr><td><p align=""center"" style=""margin: 0px; padding: 0px; font-size:30pt;""><strong>中标通知书</strong></p><p align=""right"" style=""margin: 0px; padding: 0px; font-size:14pt;"">招标编号:" + etyTenderNotice.Tendernum + @"</p><table cellspacing=""0"" cellpadding=""0"" width=""100%"" Height=""80%"" align=""center""><tr style="" height:100%""><td style=""height: 25px;"" align=""right"" valign=""top"" width=""48%"" class=""tabletd""><p align=""left"" class=""p1"" style=""padding-top:10px;""><u>" + etyTenderNotice.Successtenderdept + @"</u>:</p><br /><p  class=""p1"" align=""left""><span align=""left""></span><u>潞安环保能源开发股份有限公司:" + etyTenderNotice.TenderPeopleName + @"</u>(招标人名称)的<u>" + etyTenderNotice.Tendername + @"</u>(招标项目名称)于<u>" + etyTenderNotice.Tenderdate.ToString("yyyy年MM月dd日") + @"</u>开标后,已完成评标工作,确定你单位下列设备(材料)中标:</p><br /><div><table cellspacing=""0"" rules=""all"" border=""1"" id=""gvContractDetail"" style=""width:100%;border-collapse:collapse;""><tr align=""center""><th scope=""col"">序号</th><th scope=""col"">名称</th><th scope=""col"">规格型号</th><th scope=""col"">数量</th><th scope=""col"">金额(万元)</th></tr>");DataTable dt = _busTenderNoticeDetails.Search(new TenderNoticeDetailsEntity() { Id = etyTenderNotice.Tendernoticeid }).Tables[0];foreach (DataRow dr in dt.Rows){html.Append(@"<tr align=""center""><td>" + dr["PlanOrder"] + @"</td><td>" + dr["MachineName"] + @"</td><td>" + dr["MachineNum"] + @"</td><td>" + dr["GZSL"] + @"</td><td>" + dr["GZJE"] + @"</td></tr>");}html.Append(@"</table></div></td><td valign=""top""></td><td valign=""top"" class=""tabletd""  width=""48%"" ><p><span></span></p><p  class=""p1"">中标总价<u> " + DataConvert.ConvertSum((DataConvert.ToDecimal(etyTenderNotice.Successtenderprice) * 10000).ToString("0")) + @"(大写)</u>万元,请贵单位收到中标通知书后,在<u>" + etyTenderNotice.Lastdate.ToString("yyyy年MM月dd日") + @"</u>前持中标通知书与招标人进行合同谈判与签订。</p><p><span></span></p><p class=""p1"">招标人(盖章)潞安集团招标领导组<br>办公室(备案)</p><p><span></span></p><p  class=""p1"" align=""right"">" + etyTenderNotice.SendDate.ToString("yyyy年MM月dd日") + @"<br></p></td></tr></table><div style=""padding-top:10px;""></div><span style=""font-size: 10pt;height: 15px;line-height: 15px;"">备注:<span>1.</span>此中标通知书一式三份,招标人、中标人、集团公司招标办公室各一份。</span><br><span style=""font-size: 10pt;"">2.设备(材料)种类、项目过多超出表格时,可采用附页填报并加盖公章。</span></td></tr></table></div></body></html>");}Tools.ToWord(html);Response.End();}

C#导入word方法:

 //************************************************************************************************/// <summary>/// 将控件内容导出到Excel,传递一个控件/// </summary>/// <param name="body">控件名称</param>public static void ToDocument(StringBuilder str){//清除Response缓存内容HttpContext.Current.Response.Clear();HttpContext.Current.Response.Buffer = true;//确定字符的编码格式HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=Document.xls");HttpContext.Current.Response.ContentType = "application/ms-excel";//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/mswordHttpContext.Current.Response.Charset = "GB2312";HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");//表体空间// System.IO.StringWriter swBody = new System.IO.StringWriter();// System.Web.UI.HtmlTextWriter hwBody = new System.Web.UI.HtmlTextWriter(swBody);// body.RenderControl(hwBody);//消除乱码特别设定,非常规方法string strExcel = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">";//strExcel += hwBody.InnerWriter.ToString();HttpContext.Current.Response.Write(strExcel + str);HttpContext.Current.Response.End();}//************************************************************************************************/// <summary>/// 将控件内容导出到word,传递一个控件/// </summary>/// <param name="body">控件名称</param>public static void ToWord(StringBuilder str){//清除Response缓存内容HttpContext.Current.Response.Clear();HttpContext.Current.Response.Buffer = true;//确定字符的编码格式HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=Document.doc");HttpContext.Current.Response.ContentType = "application/msword";//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/mswordHttpContext.Current.Response.Charset = "GB2312";HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");//表体空间// System.IO.StringWriter swBody = new System.IO.StringWriter();// System.Web.UI.HtmlTextWriter hwBody = new System.Web.UI.HtmlTextWriter(swBody);// body.RenderControl(hwBody);//消除乱码特别设定,非常规方法string strExcel = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">";//strExcel += hwBody.InnerWriter.ToString();HttpContext.Current.Response.Write(strExcel + str);HttpContext.Current.Response.End();}

今天一直在弄横向导入word

在网上收了收主要就是通过css样式把要导入的html设置为横向的

首先在页面的head中加下面的一段代码
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
<!--
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:841.9pt 595.3pt;
mso-page-orientation:landscape;
margin:89.85pt 72.0pt 89.85pt 72.0pt;
mso-header-margin:42.55pt;
mso-footer-margin:49.6pt;
mso-paper-source:0;
layout-grid:15.6pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
然后用div包含整个的显示内容,会调用上面的style

<div class=Section1>

</div>

html横向导入word相关推荐

  1. Altium designer原理图导入word文档模糊——终极解决办法

    硬件相关专业的小伙伴在写毕业论文的时候可能会遇到AD原理图导入word后变模糊的情况,经过多方摸索,终于找到一个可行的方法. (1)前情回顾 网上常用的AD原理图导入word方法总结如下: 1. 直接 ...

  2. java poi读取word中附件_Java POI导入word, 带图片

    1.导入文件示例,word中简历表格模板 2.代码示例分两部分,一部分读取图片 /** * 导入word(基本信息,word格式) * @param staffId * @param baseInfo ...

  3. 国自然和毕业论文的流程图用这个格式导入Word可无限放大

    AI编辑的图片导出EMF格式可直接插入Word和PPT中 可无限放大 不推荐WMF,导入word可能会发生格式变化 还可在PPT中去除分组再编辑

  4. 苹果手机怎么编辑word文档_可以一键导入word图文的微信编辑软件有什么?编辑器怎么使用?...

    工作效率的提高除了因为熟练之外,还因为各种工具的辅助.自古以来都有工欲善其事必先利其器的教诲,好的工具能让我们工作时事半功倍.今天我们来聊聊什么工具可以提高公众号运营效率?什么微信编辑器可以讲word ...

  5. html保存导入word文档格式,WordPress网站在导入Word文档时如何保持原有格式

    WordPress程序后台有文章发布功能,可以添加文字和图片.如果想将自己在排版好的Word 文档导入到WordPress ,作为文章发布,却不是一件容易的事情,如果我们直接复制,Word 文档本身的 ...

  6. Vue 自定义富文本编辑器 tinymce 支持导入 word 模板

    自定义富文本编辑器分为前端项目和后端项目两个部分,首先先说一下前端项目 前端 前端项目地址: https://github.com/haoxiaoyong1014/editor-ui 编辑器名称: t ...

  7. MathType 如何安装成功以及如何导入word

    MathType 如何安装成功以及如何导入word (一)安装office2016 (二)安装MathType6.9 (三)MathType使用 (四)导入word 突发奇想项安装MathType,于 ...

  8. java word 题目导入_java使用poi导入word题库

    java使用poi导入word题库 包含单选,多选,填空,判断 //word图示 //具体代码,仅适合本人自己的格式 //代码一 InputStream inputStream = file.getI ...

  9. MathType如何导入word

    目标:分别安装好office 和 Mathtype.Mathtype激活不激活对这个没有影响.如何将MathType 成 功以及如何导入word 中. 出现失败的原因: 1.版本兼容性问题 我用的是w ...

最新文章

  1. 快捷简易统计图表模型设计与实现
  2. VMware 虚拟机的虚拟磁盘编程知识点扫盲之二
  3. CSS3 keyframes动画实现弹跳效果
  4. webrtc 实现web端对端视频
  5. 网站互点排名掉了网站互点排名掉了网站互点_7天上百度首页排名优化技巧有哪些?...
  6. Knative 快捷操作命令 Kn 介绍
  7. 一步步学习ASP.NET MVC3 (10)——@Ajax,JavaScriptResult(1)
  8. ads s参数拟合_ADS S参数仿真介绍
  9. 512m硬盘装linux,硬盘装linux.doc
  10. dataGridView1.DataSource多增加列,数据不进自己规定的列?
  11. 使用Anaconda安装tensorflow
  12. plt.subplot()和plt.subplots(),plt.gca(),
  13. 推荐两个有意思的公号
  14. 扇贝有道180912每日一句
  15. paip.eclipse忽然启动报错的解决
  16. 2013年7月底至8月初51Aspx源码发布详情
  17. R语言—数据的调整与处理
  18. TiDB 社区专栏:让技术人员成为更好的读者/作家
  19. win7系统中如何以管理员身份修改hosts文件
  20. 计算机专业不用学数学的有什么,大学里不用学数学的专业,不想学高数的看过来,你的专业是哪个...

热门文章

  1. 微软vs2008快捷键
  2. 用Netfilter模块实现基于令牌桶的每IP地址流量控制
  3. CentOs7.3 搭建 Solr单机服务
  4. Android 连接SQLite
  5. 优化案例--改写IN条件为INNER JOIN
  6. RHEL 6 配置yum源
  7. 《专家手记AJAX开发实战 》电子试读版发布
  8. 重磅!阿里巴巴Blink正式开源,重要优化点解读\n
  9. 一篇文章学会CORS
  10. MYSQL获取同时关注了某两个(或者N个)用户的用户