Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.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_Html_.net_Excel_.net Core - Fatal编程技术网

从HTML导出到Excel

从HTML导出到Excel,html,.net,excel,.net-core,Html,.net,Excel,.net Core,是否有任何方法可以从HTML表导出到excel。我在.NET核心应用程序中使用了HTML表格,需要使用样式格式化表格,同样的表格必须导出到excel。是的,您可以使用插件实现它 名称 位置 办公室 年龄 开始日期 薪水 老虎尼克松 系统架构师 爱丁堡 61 2011/04/25 $320,800 名称 位置 办公室 年龄 开始日期 薪水 $(文档).ready(函数(){ $('#示例')。数据表({ dom:'Bfrtip', 按钮:[ “csv”、“excel”、“pdf”、“打印” ]

是否有任何方法可以从HTML表导出到excel。我在.NET核心应用程序中使用了HTML表格,需要使用样式格式化表格,同样的表格必须导出到excel。

是的,您可以使用插件实现它


名称
位置
办公室
年龄
开始日期
薪水
老虎尼克松
系统架构师
爱丁堡
61
2011/04/25
$320,800
名称
位置
办公室
年龄
开始日期
薪水
$(文档).ready(函数(){
$('#示例')。数据表({
dom:'Bfrtip',
按钮:[
“csv”、“excel”、“pdf”、“打印”
]
} );
} );

这里有库
tableToExcel.517b1af9.js


TableToExcel.convert(document.getElementById(“idTable”);
<table id="example" class="display nowrap" style="width:100%">
        <thead>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Tiger Nixon</td>
                <td>System Architect</td>
                <td>Edinburgh</td>
                <td>61</td>
                <td>2011/04/25</td>
                <td>$320,800</td>
            </tr>
        </tbody>
    <tfoot>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </tfoot>
    </table>
<script src='https://code.jquery.com/jquery-3.5.1.js'></script>
<script src='https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js'></script>
<script>
$(document).ready(function() {
    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'csv', 'excel', 'pdf', 'print'
        ]
    } );
} );
</script>
<script src="/tableToExcel.517b1af9.js"></script>

<script>
TableToExcel.convert(document.getElementById("idTable"));
</script>