众所周知,基本的Markdown表格语法为:
| ID | 姓名 |
|:----:|:----:|
| 1 | 小明 |
| 2 | 小强 |
效果如下:
ID | 姓名 |
---|---|
1 | 小明 |
2 | 小强 |
表格语法不是特别固定,很灵活,也很丰富,比如可以做的复杂一些:
| ID | 姓名 | 性别 | 年龄 |
|:----|:-------:|----|-------:|
| 1 | 刘彤 | ♀ | 18 |
| 2 | 肖华 | ♂ | 35 |
| 44 | 李建伟 | undefined | 55 |
效果如下:
ID | 姓名 | 性别 | 年龄 |
---|---|---|---|
1 | 刘彤 | ♀ | 18 |
2 | 肖华 | ♂ | 35 |
44 | 李建伟 | undefined | 55 |
如果想定制化表格,可以借助HTML标签实现:
<table border=0 cellpadding=0 cellspacing=0 width=373 style='border-collapse:
collapse;table-layout:fixed;width:279pt'>
<col width=86 style='mso-width-source:userset;mso-width-alt:3072;width:65pt'>
<col width=130 style='mso-width-source:userset;mso-width-alt:4608;width:97pt'>
<col width=79 style='mso-width-source:userset;mso-width-alt:2816;width:59pt'>
<col width=78 style='mso-width-source:userset;mso-width-alt:2759;width:58pt'>
<tr height=18 style='height:13.8pt'>
<td colspan=2 height=18 class=xl6515568 width=216 style='height:13.8pt;
width:162pt'>班级信息</td>
<td rowspan=2 class=xl6515568 width=79 style='width:59pt'>学生ID</td>
<td rowspan=2 class=xl6515568 width=78 style='width:58pt'>学生姓名</td>
</tr>
<tr height=18 style='height:13.8pt'>
<td height=18 class=xl6515568 style='height:13.8pt'>班级ID</td>
<td class=xl6515568>班级名称</td>
</tr>
<tr height=18 style='height:13.8pt'>
<td height=18 class=xl6515568 style='height:13.8pt'>1</td>
<td class=xl6515568>计算机2001班</td>
<td class=xl6515568>20200878</td>
<td class=xl6515568>刘彤</td>
</tr>
<tr height=18 style='height:13.8pt'>
<td height=18 class=xl6515568 style='height:13.8pt'>2</td>
<td class=xl6515568>计算机2002班</td>
<td class=xl6515568>20200999</td>
<td class=xl6515568>肖华</td>
</tr>
<tr height=18 style='height:13.8pt'>
<td height=18 class=xl6515568 style='height:13.8pt'>3</td>
<td class=xl6515568>计算机2003班</td>
<td class=xl6515568>20201254</td>
<td class=xl6515568>李建伟</td>
</tr>
<tr height=18 style='height:13.8pt'>
<td height=18 class=xl6515568 style='height:13.8pt'>4</td>
<td class=xl6515568>计算机2004班</td>
<td class=xl6515568>20201777</td>
<td class=xl6515568>王冰</td>
</tr>
<tr height=18 style='height:13.8pt'>
<td height=18 class=xl6515568 style='height:13.8pt'>5</td>
<td class=xl6515568>计算机2004班</td>
<td class=xl6515568>20204567</td>
<td class=xl6515568>张彬</td>
</tr>
<tr height=18 style='height:13.8pt'>
<td height=18 class=xl6515568 style='height:13.8pt'>6</td>
<td class=xl6515568>计算机2004班</td>
<td class=xl6515568>20206743</td>
<td class=xl6515568>赵远</td>
</tr>
</table>
效果如下:
班级信息 | 学生ID | 学生姓名 | |
班级ID | 班级名称 | ||
1 | 计算机2001班 | 20200878 | 刘彤 |
2 | 计算机2002班 | 20200999 | 肖华 |
3 | 计算机2003班 | 20201254 | 李建伟 |
4 | 计算机2004班 | 20201777 | 王冰 |
5 | 计算机2004班 | 20204567 | 张彬 |
6 | 计算机2004班 | 20206743 | 赵远 |
实现该效果可以通过Excel实现,即Excel生成对应表格后,选中对应区域,另存为html文件,再从html中取出对应的<table></table>
标签内的内容加以微调即可。