Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Excel无法为导入的web表正确呈现CSS_Html_Css_Excel_Vba - Fatal编程技术网

Html Excel无法为导入的web表正确呈现CSS

Html Excel无法为导入的web表正确呈现CSS,html,css,excel,vba,Html,Css,Excel,Vba,我正在尝试将一个web表(带有一些CSS格式)导入excel;但是,Excel拒绝正确呈现它。这是我的HTML <html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> table { table-layout:auto; borde

我正在尝试将一个web表(带有一些CSS格式)导入excel;但是,Excel拒绝正确呈现它。这是我的HTML

<html>
    <head>
        <META http-equiv="Content-Type" content="text/html; charset=utf-8">
        <style type="text/css">
            table { table-layout:auto; border-collapse:collapse; border:thin solid black; font-family:Arial; }
            th { } 
            .Headline { padding:0pt; font-size:9pt; background-color:#FFFF00; color:#FF0000; border:thin solid black; vertical-align:top; }
            tbody { border:1px solid Black; }
            tbody:nth-child(odd) { background: RGB(255, 255, 220); }
            tbody:nth-child(even) { background: RGB(238, 255, 255); }           
            td { vertical-align:top; border:thin dotted Silver; padding:0pt; font-size:8pt; padding-right:3px; padding-left:3px; mso-number-format:"\@"; }
            pre { margin:0; padding:0; white-space:pre-wrap; font-size:8pt; font-family:Arial; }
        </style>
    </head>
    <body>
        <table>
            <th class="Headline">TC #</th>
            <th class="Headline">Steps</th>
            <th class="Headline">Details</th>
            <th class="Headline">Timestamp</th>
            <tbody>
                <tr>
                    <td class="UCNumber">1</td>
                    <td class="Level1">▬▬ UC_010 ▬▬</td>
                    <td><pre>Product Multiple; Event = NEW</pre></td>
                    <td>01/04/2015 - 10:43:54</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">●●● TD_SETUP</td>
                    <td><pre>Executing script steps of TD_SETUP</pre></td>
                    <td>01/04/2015 - 10:43:54</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">Statement Skipped: #NEWAMEND</td>
                    <td><pre>0</pre>
                    </td>
                    <td>01/04/2015 - 10:43:55</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">Statement Skipped: #OUTBOUND</td>
                    <td><pre>2</pre>
                    </td>
                    <td>01/04/2015 - 10:43:55</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">●●● TD_VERIFYNEWAMEND</td>
                    <td><pre>Executing script steps of TD_VERIFYNEWAMEND</pre></td>
                    <td>01/04/2015 - 10:44:01</td>
                </tr>
            </tbody>
            <tbody>
                <tr>
                    <td class="UCNumber">2</td>
                    <td class="Level1">▬▬ UC_011 ▬▬</td>
                    <td><pre>Product Multiple; Event = AMEND</pre></td>
                    <td>01/04/2015 - 10:45:14</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">●●● TD_SETUP</td>
                    <td><pre>Executing script steps of TD_SETUP</pre></td>
                    <td>01/04/2015 - 10:45:14</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">Statement Skipped: #NEWAMEND</td>
                    <td><pre>0</pre></td>
                    <td>01/04/2015 - 10:45:14</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">Statement Skipped: #OUTBOUND</td>
                    <td><pre>2</pre></td>
                    <td>01/04/2015 - 10:45:14</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">●●● TD_VERIFYNEWAMEND</td>
                    <td><pre>Executing script steps of TD_VERIFYNEWAMEND</pre></td>
                    <td>01/04/2015 - 10:45:20</td>
                </tr>
            </tbody>
            <tbody>
                <tr>
                    <td class="UCNumber">3</td>
                    <td class="Level1">▬▬ UC012 ▬▬</td>
                    <td><pre>Product Multiple; Event = CANCEL</pre></td>
                    <td>01/04/2015 - 10:46:34</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">●●● TD_SETUP</td>
                    <td><pre>Executing script steps of TD_SETUP</pre></td>
                    <td>01/04/2015 - 10:46:34</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">Statement Skipped: #CANCEL</td>
                    <td><pre>3</pre></td>
                    <td>01/04/2015 - 10:46:34</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="Level1">●●● TD_VERIFYCANCEL</td>
                    <td><pre>Executing script steps of TD_VERIFYCANCEL</pre></td>
                    <td>01/04/2015 - 10:46:40</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

Excel不是web浏览器。它有CSS的概念吗?我和MatthewD在一起,Excel不是web浏览器。但是“.PreserveFormatting=False”与此有关系吗?@MatthewD-看起来像是Excel选择要呈现的CSS。我想知道如何确保它呈现所有格式。@n8wrl-即使使用
PreserveFormatting=True
,结果也是一样的。Excel不是web浏览器。它有CSS的概念吗?我和MatthewD在一起,Excel不是web浏览器。但是“.PreserveFormatting=False”与此有关系吗?@MatthewD-看起来像是Excel选择要呈现的CSS。我想知道如何确保它呈现所有格式。@n8wrl-即使使用
PreserveFormatting=True
,结果也是一样的。
conStr = "URL;file:///" & curResDir & "\Results.html"
With ActiveWorkbook.ActiveSheet.QueryTables.Add(Connection:=conStr, Destination:=Range("A1"))
    .Name = "QTPResult"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = False
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlOverwriteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .WebSelectionType = xlSpecifiedTables
    .WebFormatting = xlWebFormattingAll
    .WebTables = "1"
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = True
    .WebDisableDateRecognition = True
    .WebDisableRedirections = True
    .Refresh BackgroundQuery:=False
End With