2个回答
展开全部
首先打开一个excel文件然后将repeater生成的html标签直接写入这个文件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看一下你的指令是这吗?<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" EnableEventValidation="false"%>
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.Charset = "GB2312";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=Hello.xlsx");
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
Repeater1.RenderControl(htw); //ID的名称:Repeater
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.Charset = "GB2312";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=Hello.xlsx");
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
Repeater1.RenderControl(htw); //ID的名称:Repeater
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询