I'm exporting data into Excel file by generating a plain html structure in VBscript, like this:
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=excelTime.xls"
response.write "<table>"
response.write "<tr>"
response.write "<td>User Name</td>"
...
Some data cells contain multiple values, separated by comma. I have a requirement to write such values in a separate line each but within the same cell, without commas, like this:
Just as if I have put Alt+Enter in Excel after each value. I try to use VBscript Replace() function to substitute commas with line breaks, like this:
Response.write "<td>" & Replace(Value, ",", " <br/> ") & "</td>"
But it breaks a cell into multiple cells instead:
How can I achive the desired result here? I tried different variants, but nothing helped:
Replace(Value, ",", " vbCrLf ") 'does not put a line break
Replace(Value, ",", " CHAR(13) ") 'puts the "CHAR(13)" text between values
Replace(Value, ",", " \\n ") 'puts the "\\n" text between values
Replace(Value, ",", " \n ") 'puts the "\n" text between values
Replace(Value, ",", " \r ") 'puts the "\n" text between values
Maybe you know some other way to do it?