单元格背景颜色导出HTML到Excel单元格、颜色、背景、Excel

2023-09-04 23:14:38 作者:1杯敬相逢

我想导出HTML表到excel,但我不能设置一个单元通过CSS的背景颜色,我已经试过:

I am trying to export an HTML table to excel but I cannot set the background color of a cell by CSS, I've tried:

Response.Write("<style type=\"text/css\">");
Response.Write("td { background-color: #000000; }");
Response.Write("</style>");

但是,这并没有对我的输出影响。是否有单元格颜色一些MSO的CSS属性?

But this has no affect on my output. Is there some mso css attribute for cell color?

推荐答案

尝试使用类似的东西来&LT;内饰SS:颜色='#01F501'SS:模式='实'/&GT; ...

Try to use something similar to <Interior ss:Color='#01F501' ss:Pattern='Solid'/>...

对于一些深入的关于HTML的方法来创建Excel文件样本code见的http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx

For some in-depth information regarding the HTML approach to creating Excel files with sample code see http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx

此外,在 HTTP签正式文件msdn.microsoft.com/en-us/library/Aa155477%28office.10%29.aspx