将数据从html复制粘贴到excel时的格式问题

时间:2015-10-14 08:58:04

标签: html css html5 excel jquery-datatables-editor

我有一个我从Php生成的表,我正在使用datatable.js为数据添加一些选项和分页。

当我通过执行ctrl + a和ctrl + c复制并粘贴数据到Excel时,然后按ctrl + v(windows)

a)在chrome中,我得到了这样的下拉列表(http://prntscr.com/8r4x71),但表格没有被破坏。

b)在firefox中我没有得到恼人的下拉,但是最后一行的表格是这样的(http://prntscr.com/8r4vqy

我创造了一个简单的小提琴来代表问题 http://jsfiddle.net/63g6e655/2/

下面是html,js和css在小提琴中

<div id="content" class="well well-lg">

    <div id="mainContent">


        <table id="report_gen_user" width="100%" cellspacing="0" border="1" align="left">
            <thead>
                <tr>
                    <th>Date</th>
                    <th>Quantity</th>
                    <th>item</th>
                    <th>Features </th>
                    <th>Price</th>
                    <th>Total(USD)</th>
                    <th>Reference</th>
                    <th>Transaction ID</th>
                    <th>id</th>
                    <th>generated by </th>
                </tr>

            </thead>
            <tbody>


                                    <tr>
                                <td>&nbsp;2009-10-03</td>
                                <td>4000</td>
                                <td>lorum ipsum lorum ipsum</td>
                                <td> test</td>
                                <td>0</td>
                                <td>0</td>
                                <td>lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>b</td>
                            </tr>
                                    <tr>
                                <td>&nbsp;2009-10-03</td>
                                <td>2000</td>
                                <td>Ilorum ipsum</td>
                                <td> lorum ipsum</td>
                                <td>0</td>
                                <td>0</td>
                                <td>lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>b</td>
                            </tr>
                                    <tr>
                                <td>&nbsp;2009-10-03</td>
                                <td>4000</td>
                                <td>lorum ipsum</td>
                                <td> lorum ipsum</td>
                                <td>0</td>
                                <td>0</td>
                                <td>lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>bf</td>
                            </tr>
                                    <tr>
                                <td>&nbsp;2009-10-03</td>
                                <td>2000</td>
                                <td>aaa</td>
                                <td> aaa</td>
                                <td>0</td>
                                <td>0</td>
                                <td>asdadasd</td>
                                <td>&nbsp;asdad</td>
                                <td>&nbsp;asdasd</td>
                                <td>b</td>
                            </tr>
                                    <tr>
                                <td>&nbsp;2009-10-03</td>
                                <td>2000</td>
                                <td>asdadE</td>
                                <td> lorum ipsum</td>
                                <td>0</td>
                                <td>0</td>
                                <td>lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>lorum ipsum</td>
                            </tr>
                                    <tr>
                                <td>&nbsp;2009-10-03</td>
                                <td>2000</td>
                                <td>lorum ipsum lorum ipsum</td>
                                <td> test</td>
                                <td>0</td>
                                <td>0</td>
                                <td>lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>bt</td>
                            </tr>
                                    <tr>
                                <td>&nbsp;2009-10-03</td>
                                <td>2000</td>
                                <td>lorum ipsum</td>
                                <td> lorum ipsum</td>
                                <td>0</td>
                                <td>0</td>
                                <td>lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>bfg</td>
                            </tr>
                                    <tr>
                                <td>&nbsp;2009-10-03</td>
                                <td>2000</td>
                                <td>lorum ipsum</td>
                                <td> lorum ipsum</td>
                                <td>0</td>
                                <td>0</td>
                                <td>lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>&nbsp;lorum ipsum</td>
                                <td>bfsg</td>
                            </tr>



            </tbody>
            <tfoot>
                <tr>
                    <th>Totals:</th>
                    <th >&nbsp;</th>
                    <th class="unselect" >&nbsp;</th>
                    <th >&nbsp;</th>
                    <th >&nbsp;</th>
                    <th >&nbsp;</th>
                    <th >&nbsp;</th>
                    <th >&nbsp;</th>
                    <th >&nbsp;</th>
                    <th >&nbsp;</th>
                </tr>
            </tfoot>
        </table>

    </div>

对于解决上述两个问题,我们将不胜感激。

0 个答案:

没有答案