如何使用response.setcontenttype("")导出到excel。 [英] How do I export to excel by using response.setcontenttype("").

查看:1280
本文介绍了如何使用response.setcontenttype("")导出到excel。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



我在Javascript中有问题,我有一个报告,我想在每次点击按钮时将这些报告导出到Exccel中。当我打开导出到Excel按钮时,它显示空白屏幕,但似乎它适用于台式机。



这是代码片段,你能不能请帮助我这个



我尝试过:



  var  exportXML = strxml; 
response.setContentType(' PLAINTEXT' ' ExcelResults.xls'' 附件);
response.write(exportXML);

解决方案

它在VB中你应该能够转换。



 Response.AddHeader(  content -disposition  attachment; filename =& strFileName& < span class =code-string>   
Response.ContentType = application / vnd.ms-excel

Response.Charset =

Response.ContentEncoding = Encoding.UTF8

' 关闭视图状态。
EnableViewState = False

响应。 Clear()
Response.Write(strExcelFileContents)' 您的Excel文件

' 结束回复。
回复。结束()


Hello All,

I have Question in Javascript, I have one report and i want to export those report into Exccel whenever i click on the button. When i open the Export to Excel button it shows the Blank Screen but it seems that it is working fine for Desktop machines.

Here is the Code Snippet, Can you please help me on this

What I have tried:

var exportXML = strxml;
response.setContentType('PLAINTEXT', 'ExcelResults.xls', 'attachment');
				response.write(exportXML);

解决方案

Its in VB but you should be able to convert.

Response.AddHeader("content-disposition", "attachment; filename=""" & strFileName & """")
Response.ContentType = "application/vnd.ms-excel"

Response.Charset = ""

Response.ContentEncoding = Encoding.UTF8

' Turn off the view state.
EnableViewState = False

Response.Clear()
Response.Write(strExcelFileContents) 'Your Excel file

' End the response.
Response.End()


这篇关于如何使用response.setcontenttype(&quot;&quot;)导出到excel。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆