开发者

Error when converting from HTML to Word

开发者 https://www.devze.com 2022-12-16 12:28 出处:网络
When I convert the HTML content to MS Word, a thread aborted error message occurs. Below is the error log:

When I convert the HTML content to MS Word, a thread aborted error message occurs. Below is the error log:

HttpContext.Current.Re开发者_开发百科sponse.Clear()
HttpContext.Current.Response.Charset = ""
HttpContext.Current.Response.ContentType = "application/msword"

Dim strFileName As String = "GenerateDocument" + ".doc"
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;filename=" + strFileName)

Dim strHTMLContent As New StringBuilder()
HttpContext.Current.Response.Write(strHTMLContent)

HttpContext.Current.Response.Flush()
HttpContext.Current.Response.End()


Calling Response.End() always results in a ThreadAbortException.

Is that causing any problems or are you just wondering why it is happening?

Also, I see in your code you are declaring a new StringBuilder, never adding any text to it, and then writing it out to the response. This will always be empty - is that deliberate?

0

精彩评论

暂无评论...
验证码 换一张
取 消