开发者

HTML Table to XLS (Cell used for a formula)

开发者 https://www.devze.com 2023-03-08 11:17 出处:网络
I am doing an HTML table and I want it to be converted to XLS file I am using this table for example <table>

I am doing an HTML table and I want it to be converted to XLS file

I am using this table for example

<table>
    <tr>
        <td>AUD</td>
        <td>200.00</td>
    </tr>
    <tr>
        <td>AUD</td>
      开发者_如何转开发  <td>200.00</td>
    </tr>
    <tr>
        <td>AUD</td>
        <td>200.00</td>
    </tr>
    <tr>
        <td>EUR</td>
        <td>300.00</td>
    </tr>
    <tr>
        <td>AUD</td>
        <td>200.00</td>
    </tr>
    <tr>
        <td>AUD</td>
        <td>200.00</td>
    </tr>
    <tr>
        <td>AUD</td>
        <td>200.00</td>
    </tr>
    <tr>
        <td>AUD</td>
        <td>**=SUM(A2:A10);**</td>
    </tr>
</table>

Is there a way how I can create a cell with the =SUM(A2:A10); as a formula and not a normal plain text?


When importing html to excel, it is important to know that there are a variety of excel-specific attributes that you can use to get excel to perform pretty much like you would expect it to, for nearly any business requirement.

You'll need the excel namespaces added:

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
</html>

And then you can create a formula in a table cell:

<td x:num x:fmla="=SUM(A2,A10)">0</td>

You can read much more about properly implementing these capabilities in this article: http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx


This works for me:

replace

<tr>
<td>AUD</td><td>**=SUM(A2:A10);**</td>
</tr>

with

<tr>
<td>AUD</td><td>=SUM(A2:A10)</td>
</tr>
0

精彩评论

暂无评论...
验证码 换一张
取 消