在Windows应用程序中将数据从datagridview导出到ms-word的代码是什么 [英] what is the code for exporting data from datagridview to ms-word in windows application

查看:60
本文介绍了在Windows应用程序中将数据从datagridview导出到ms-word的代码是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常需要此代码,请帮助我获取代码并执行此程序

I need this code very urgent ,please help me to get the code and execute this program

推荐答案

代码如下
protected void Button1_Click(object sender, EventArgs e)
{
    Response.Clear();
    Response.Buffer = true;
    
    Response.AddHeader("content-disposition", "attachment;filename=FileName.doc");
    
    Response.ContentEncoding = System.Text.Encoding.UTF7;
    Response.ContentType = "application/vnd.word";
    System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
    this.GridView1.RenderControl(oHtmlTextWriter);
    Response.Output.Write(oStringWriter.ToString());
    Response.Flush();
    Response.End();
}



|我非常需要此代码,请帮助我获取代码并执行此程序
|标签:C ++,C#


但您的代码包含C ++:confused:&然后您提到您急需代码.:confused:



|I need this code very urgent ,please help me to get the code and execute this program
|Tags: C++, C#


but your Tag inclues C++:confused: & then you mentioned that you need the code urgently.:confused:


这篇关于在Windows应用程序中将数据从datagridview导出到ms-word的代码是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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