Hello,
I've made a simple website for someone to use to be able to enter/update and review data in a database. I have everything working, even a printer friendly page and exporting to PDF without issue. It's the exporting to Word that's causing problems in only one area: when there's a multi-line Label with <br/> inserted for proper HTML formatting.
I have a few labels filled with data from a database that was inserted with multi-line text from a textbox. Everything shows up fine, and like I said, it exports to the printer friendly page and to PDF fine with the proper line breaks/formatting. But Word refuses to see them. Any suggestions?
Here's my code for my export function (VB.NET):
Thanks for your help.
I'm here to help.
I've made a simple website for someone to use to be able to enter/update and review data in a database. I have everything working, even a printer friendly page and exporting to PDF without issue. It's the exporting to Word that's causing problems in only one area: when there's a multi-line Label with <br/> inserted for proper HTML formatting.
I have a few labels filled with data from a database that was inserted with multi-line text from a textbox. Everything shows up fine, and like I said, it exports to the printer friendly page and to PDF fine with the proper line breaks/formatting. But Word refuses to see them. Any suggestions?
Here's my code for my export function (VB.NET):
Code:
Try
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment;filename=" & fileName)
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.ContentType = "application/ms-word"
Response.Charset = "UTF-8"
Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble)
Dim oStringWriter As New StringWriter()
Dim oHtmlTextWriter As New HtmlTextWriter(oStringWriter)
'pnlDetails.RenderControl(oHtmlTextWriter)
'PrepareControlForExport(divDetails)
divDetails.RenderControl(oHtmlTextWriter)
Response.Output.Write(oStringWriter.ToString)
Response.Flush()
Catch ex As Exception
lblErrors.Visible = True
Elmah.ErrorSignal.FromCurrentContext.Raise(ex)
Finally
Response.End()
End Try
Thanks for your help.
I'm here to help.