Excel-friendly html: keeping a list inside a single cell

こ雲淡風輕ζ 提交于 2020-01-15 10:07:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!