Excel友好的html:在单个单元格内保留一个列表

我知道,当生成需要在Excel中查看的HTML,如果我想确保<br>标记不会导致生成一个新的行,我可以指定

 <style><!--table br {mso-data-placement:same-cell;} --></style> 

<head>部分。

如果我需要列表的相同行为(即<ul><ol>部分中的内容被包含在同一个单元格中),我需要做什么?

正如你们中许多人所知道的那样,只要添加正确的content-type和content-disposition标题,就可以将数据(例如报告)作为Excel文件输出。

Response.ContentType =“application / vnd.ms-excel”;

Response.AppendHeader(“content-disposition”,“inline; filename = report.xls”);

添加到样式表中:

br {mso-data-placement:same-cell;}