添加编码以将GridView输出到Word

时间:2018-10-31 11:11:22

标签: .net vb.net

使用以下代码,我将GridView输出到Microsoft Word(通过HTML)

Response.Clear()
    Response.Buffer = True
    Response.AddHeader("content-disposition", "attachment;filename=" & CountryName & ".doc")
    Response.Charset = ""
    Response.ContentType = "application/vnd.ms-word "
    Dim sw As StringWriter = New StringWriter()
    Dim hw As HtmlTextWriter = New HtmlTextWriter(sw)
    gridview1.AllowPaging = False
    gridview1.DataBind()
    gridview1.RenderControl(hw)
    Response.Output.Write(sw.ToString())
    Response.Flush()
    Response.[End]()

但是它包含诸如É之类的字符,因此将其更改为É

这是编码问题吗?如果是这样,如何更改编码以支持这些字符?

0 个答案:

没有答案