问题
I know that when generating html that needs to be viewed in Excel, if I want to ensure that <br>
tags don't cause a new row to be generated, I can specify
<style><!--table br {mso-data-placement:same-cell;} --></style>
In the <head>
section.
What do I need to do if I want the same behaviour for lists (i.e. for content inside of <ul>
or <ol>
sections to be contained in the same cell)?
回答1:
As many of you probably know, you can output data (a report, for example) as an Excel file, simply by adding right content-type and content-disposition header:
Response.ContentType = “application/vnd.ms-excel“;
Response.AppendHeader(“content-disposition“, “inline; filename=report.xls“);
add into a stylesheet:
br {mso-data-placement:same-cell;}
来源:https://stackoverflow.com/questions/3563680/excel-friendly-html-keeping-a-list-inside-a-single-cell