最近要把HTML页面中的Table导出到Excel中去,可是Table的样式没有在Excel中显示出来,后来百度了一下,也买发现解决办法,大部分都提到了NPOI插件去解决,但是因为时间少没时间去看,后来自己尝试了把导出到Excel中的字符串写入文本看了下,然后在复制到一个html页面才发现是样式的问题。最后使用行内样式解决了问题。
html页面的代码:
<table id="datatable" class="panelContentTopTable" width="100%" runat="server">
<tr>
<td class="gridBorder" style="padding: 3px 3px 3px 3px;">
<cc1:CustRepeater ID="CustRepeater1" runat="server" OnItemDataBound="CustRepeater1_ItemDataBound">
<HeaderTemplate>
<!--开始-->
<table id="datatable" width="100%" cellpadding="0" cellspacing="0" style="border-width: 0px;
border-left: solid 1px #94D4F8; border-top: #94D4F8 1px solid; width: 100%;">
<tr style="text-align: center; font-weight: bold; text-align: center; background: #D2F1FD;">
<td rowspan="2" style="padding: 2px; border-right: solid 1px #94D4F8; border-bottom: solid 1px #94D4F8;
height: 22px; font-size: 13px;">
单位名称
</td>
<td rowspan="2" style="padding: 2px; border-right: solid 1px #94D4F8; border-bottom: solid 1px #94D4F8;
height: 22px; font-size: 13px;">
设备在线
</td>
<td rowspan="2" style="padding: 2px; border-right: solid 1px #94D4F8; border-bottom: solid 1px #94D4F8;
height: 22px; font-size: