[英]CSS Formatting for Excel Web Query
I am having a hard time finding good documentation for this really handy feature of Excel. 我很难为Excel的这一非常方便的功能找到好的文档。 Please see the below code and jsFiddle for reference. 请参阅下面的代码和jsFiddle作为参考。
This jsFiddle contains the following code: 该jsFiddle包含以下代码:
CSS CSS
body { font-family: calibri, san-serif; font-size:9pt; }
td, th { white-space: nowrap; }
.date { mso-number-format: "Short Date"; }
.text { mso-number-format: "\@"; }
.percent { mso-number-format: "Percent"; text-align:right; }
.int { mso-number-format: "\#\,\#\#0"; text-align:right;}
.account { mso-number-format: "\#\,\#\#0;[Red\]\(\#\,\#\#0\);\-"; text-align:right;}
.money { mso-number-format: "Currency"; text-align:right; }
HTML HTML
<table>
<thead>
<tr>
<th filter="all">Animal</th>
<th filter="all">Food</th>
<th filter="all">Number</th>
<th filter="all">Date</th>
<th filter="all">Percent</th>
<th filter="all">Money</th>
</tr>
</thead>
<tbody>
<tr>
<td>Dog</td>
<td>Pizza</td>
<td class="account">-10.999</td>
<td class="date">12/13/2013 00:00:00</td>
<td class="percent">1</td>
<td class="money">.98</td>
</tr>
<tr>
<td>Cat</td>
<td>Hamburger</td>
<td class="account">0</td>
<td class="date">1/30/2012 00:00:00</td>
<td class="percent">.25</td>
<td class="money">0</td>
</tr>
<tr>
<td>Lizard</td>
<td>Guacamole</td>
<td class="account">988823.2311</td>
<td class="date">7/20/2013 00:00:00</td>
<td class="percent">.75</td>
<td class="money">-1000.5</td>
</tr>
</tbody>
<tfoot>
<tr>
<td ></td>
<td ></td>
<td class="account" formula="sum(c2:c4)"></td>
<td class="date" formula="max(d2:d4)"></td>
<td class="percent" formula="average(e2:e4)"></td>
<td class="money" formula="sum(f2:f4)"></td>
</tr>
</tfoot>
</table>
I am pulling this into Excel with the following query file [paste into notepad and save with .iqy extension to run] : 我将其与以下查询文件一起拖入Excel [粘贴到记事本中并以.iqy扩展名保存以运行] :
WEB
1
http://jsfiddle.net/CS98V/show/
Selection=1
Formatting=All
PreFormattedTextToColumns=False
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False
My question is if and how can I apply Excel theme styles to the rows? 我的问题是,是否以及如何将Excel主题样式应用于行? I understand how to style them with CSS, but I am looking to style them using the user's defined theme; 我了解如何使用CSS设置样式,但是我希望使用用户定义的主题来设置样式。 specifially I want to set THEAD
to Excel's " Header 4 " style and the TFOOT
to the " Total " style. 具体来说,我想将THEAD
设置为Excel的“ Header 4 ”样式,将TFOOT
设置为“ Total ”样式。
You can't get data directly from JS Fiddle. 您无法直接从JS Fiddle获取数据。 You'll need page which contains HTML table only, without iframes etc. 您需要的页面仅包含HTML表格,没有iframe等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.