将表格导出为Excel,将列格式导出为文本格式

时间:2017-11-06 08:59:54

标签: javascript excel twitter-bootstrap bootstrap-table filesaver.js

我正在使用bootstrap-table在我的页面中显示表格,并使用TableExport.jsFileSaver.js.xlsx.core.min.js库来将表保存在.xlslx中格式。

问题是excel中的以下列以通用格式显示,导致值显示为1,00582E+11,而正确的值为100582012421

我尝试data-tableexport-msonumberformat="\@"强制导出过程将此列视为文本,但结果并未发生变化。我也读了这个类似的question,我创建了一个CSS

.text{ mso-number-format:"\@";/*force text*/ }

但这个解决方案对我来说都不适用..

<table id="mytable" class="table table-hover" 
       ...
       data-url="myfile.json" 
       ...                
       >
    <thead>
        <tr>
            ...
            <th data-field="productId" data-tableexport-msonumberformat="\@">Product</th>
            ...
        </tr>
    </thead>
</table>

1 个答案:

答案 0 :(得分:0)

在类中使用 tableexport-string

cd C:\Users\user\AppData\Local\Android\Sdk\emulator && emulator -avd Nexus_5_API_28