如何从arry DATA制作表格

时间:2019-06-05 20:42:46

标签: javascript excel text printing datatable

如何将这种形式的文本文件中加载的数据打印到表格中

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/exam</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">admin</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.format_sql">true</property>
        <property name="hibernate.hbm2ddl.auto">update</property>
        <mapping class="Bean.Student"/>
    </session-factory>
</hibernate-configuration>

(仅作为示例)

['1','apple','banana','1'],

['2','joystick','game','1'],

['3','help','me','1'],

1 apple banana 1

2 joystick game 1

3 help me 1

救救我

1 个答案:

答案 0 :(得分:0)

这应该有效:

document.body.innerHTML = '<table>'+data.map(row=>'<tr>'+row.map(cell=>'<td>'+cell+'</td>').join('')+'</tr>').join('')+'</table>';