将HTML表从ASP导出到Excel

编程入门 行业动态 更新时间:2024-10-26 10:36:54
本文介绍了将HTML表从ASP导出到Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好!美好的一天! 我在Excel中导出表格时页面设置出现问题.单击导出按钮时,我需要自动将纸张布局分配给横向. 我在将html表扩展为excel时没有问题,当我点击导出时,我只需要将可能的纸张分配给横向表格即可.有谁知道代码该怎么做?谢谢大家! 非常感谢您的参与.我期待着您的答案.谢谢你,上帝保佑,祝你有美好的一天. :)

Hello guy! good DAY! Im having a problem in the Page setup when i export my table in excel. I need to automatically assign the paper layout to landscape when i click my export button. I have no problem in exprting my html table to excel i need just to assign may paper to a landscape form when i hit the export. does anyone know the code how to do it? thanks guys! Thank youvery much in advnace. im looking forward to you answers. thank you, God bless and have a great day forward. :)

推荐答案

确定 我发现有类似以下内容的内容: jwcooney/2011 /09/08/generating-excel-documents-through-html-xml-and-css-part-2/ [ ^ ] OK I have fount something like this check this: jwcooney/2011/09/08/generating-excel-documents-through-html-xml-and-css-part-2/[^]

使用网格线将HTML表导出到Excel [ ^ ]和讨论此处 [ ^ ]可能会为您提供帮助 Export HTML table to Excel with grid lines[^] and the discussion here[^] might help you out.

发送HTML表ID到参数"ctl" 公共无效exportGridToExcel(Control ctl) { 字符串附件=附件;文件名= etrack_excel_export.xls"; HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.AddHeader("content-disposition",附件); HttpContext.Current.Response.ContentType ="application/ms-excel"; StringWriter stw = new StringWriter(); HtmlTextWriter htextw =新的HtmlTextWriter(stw); ctl.RenderControl(htextw); HttpContext.Current.Response.Write(stw.ToString()); HttpContext.Current.Response.End(); } send your HTML table id to the parameter ''ctl'' public void exportGridToExcel(Control ctl) { string attachment = "attachment; filename=etrack_excel_export.xls"; HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.AddHeader("content-disposition", attachment); HttpContext.Current.Response.ContentType = "application/ms-excel"; StringWriter stw = new StringWriter(); HtmlTextWriter htextw = new HtmlTextWriter(stw); ctl.RenderControl(htextw); HttpContext.Current.Response.Write(stw.ToString()); HttpContext.Current.Response.End(); }

更多推荐

将HTML表从ASP导出到Excel

本文发布于:2023-10-23 01:49:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519380.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:导出到   HTML   ASP   Excel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!