Excel-friendly html: keeping a list inside a singl

2019-07-27 22:13发布

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条回答
爷、活的狠高调
2楼-- · 2019-07-27 22:36

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;}

查看更多
登录 后发表回答