简体   繁体   English

Excel Web查询的CSS格式

[英]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.

相关问题 CSS格式问题 - 网页设计的新手 - CSS formatting problems - new to web design 整个网页上的HTML&CSS更改日期格式 - HTML&CSS Change Date Formatting On Whole Web Page 媒体查询CSS仅在本地和网络上工作 - Media Query CSS work only locally and in the web 如果一个媒体查询没有CSS格式,则html内容会捕获另一个媒体查询? - If one media query dont have CSS formatting, html content catches another media query? 如何使用Excel VBA单击Web CSS按钮? - How to use Excel VBA to click a web CSS button? 将网页导出到Excel时保留CSS样式 - Preserving CSS styling when exporting web page to Excel 使用 css 格式将表导出到 excel - 在 excel 中提供警报消息 - “文件名.xls 的文件格式和扩展名不匹配。” - Export table to excel with css formatting - gives alert message in excel - “The file format and extension of filename.xls don't match.” 使用jquery将CSS复制到内联(或在从网页复制内容时保留格式) - Copying CSS to inline using jquery (or retaining formatting when copying stuff from a web page) 如何在电子邮件客户端和HTML网页之间保留HTML / CSS格式? - How can I preserve HTML/CSS formatting between email client and HTML web page? 仅使用CSS格式化文本 - Formatting text only with CSS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM