Programming Line Breaks into Cells
I found the solution!
I was using the following header in an ASP page to generate an Excel
spreadsheet from a database report.
----
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition", "attachment;
filename=JPIJobsProfiles.XLS"
----
But the output streamed into excel did not contain any chr(10) line breaks -
hence no line breaks in my Excel cell.
The solution is two-fold.
1) At the server level use 'Replace(strText, chr(13), "<br /")' to convert
chr(10) into "<br /".
2) The problem then is that "<br /" in Excel would split the text over
multiple cells. The solution was to use the following style in the ASP
page for the '<br' tag:
----
br {mso-data-placement:same-cell;}
----
I found this solution online, but am reposting for the benefit of others.
Regards,
Wayne C.
|