正常你也可以自己下一个kindeditor,放在本地用,要是不懂代码,就直接在百度上搜那个关键字就可以了
希望对你有帮助
添加命名空间:
using System.IO
using System.Text
然后
/// <summary>/// 导出Excel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Button1_Click(object sender, EventArgs e)
{
Export("application/ms-excel", "Employee information.xls")
}
/// <summary>
/// 定义导出Excel的函数
/// </summary>
/// <param name="FileType"></param>
/// <param name="FileName"></param>
private void Export(string FileType, string FileName)
{
Response.Charset = "GB2312"
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.AppendHeader("Content-Disposition", "attachmentfilename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString())
Response.ContentType = FileType
this.EnableViewState = false
StringWriter tw = new StringWriter()
HtmlTextWriter hw = new HtmlTextWriter(tw)
GridView1.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
}
/// <summary>
/// 此方法必重写,否则会出错
/// </summary>
/// <param name="control"></param>
public override void VerifyRenderingInServerForm(Control control)
{
}
将其中的GridView换成Repeater即可。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)