html中的table导入到excel中,表格被撑宽

兵工厂三剑客 2018-01-17 03:04:23
我现在把html中的table内容导入到excel中,但是如果是一个table的话,表格内容不会被撑宽,但是如果是多个table的话,表格就会被撑开。html内容如下:

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel">
<head>
<xml>
<x:WorksheetOptions>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</xml>
</head>
<body>
<table class="form-table a4-v" width="657" style="background-color: rgb(255, 255, 255); table-layout: fixed; width: 900px;word-break:break-all;">
<tbody>
<tr style="width:657px;">
<td class="form-label" width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: center; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgb(255, 255, 255);">
安全措施
</td>
<td colspan="8" width="584" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);">
1.驻站联络员按规定时间到达车站,及时做好相关准备工作
2.在工作中严格执行标准化用语,必须讲普通话,做到口齿清晰、复诵正确。
3.出工前带齐工料具,计划,行车防护记录,印章,袖标,证件,确保齐全。
4.熟悉封锁、停电范围。
5.认真办理封锁、停电手续,核对调度命令正确无误后方可传达命令。
6.认真办理封锁、停电手续,核对调度命令正确无误后方可传达命令
7.驻站联络员作业期间坚守岗位,精力集中,及时、准确、清晰地传递行车信息和信号;作业过程中每3到5分钟与现场防护人员联系一次,确保联系畅通;作业未销记前,不得擅离工作岗位。
8.站场作业与电务保持联系动道岔及时联系工作领导人。
9.每3-5分钟与现场进行一次联系,确保联系畅通。
10.作业未销记前,不得擅离工作岗位。

</td>
</tr>
<tr>
<td class="form-label" width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: center; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgb(255, 255, 255);">
完成情况
</td>
<td colspan="8" width="584" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);"/>
</tr>
<tr>
<td class="form-label" width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: center; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgb(255, 255, 255);">
乘车方式及上下道口
</td>
<td colspan="8" width="584" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);">
去乘:粤BZ7098,上道口:光明城站(陈武扎)、返乘:粤BZ7098,下道口:光明城站(陈武扎)
</td>
</tr>
<tr>
<td class="form-label" width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: center; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgb(255, 255, 255);">
未处理缺陷记录
</td>
<td colspan="6" width="438" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);"/>
<td class="form-label" width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: center; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgb(255, 255, 255);">
质检员
</td>
<td width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);"/>
</tr>
<tr class="page-break" style="display: table-cell">
<td colspan="9" style="border: 0; color: rgb(34, 34, 34); padding: 2px 2px; font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);" width="657">
<span style="page-break-after:always">
?
</span>
</td>
</tr>
</tbody>
</table>
<table class="form-table a4-v" width="657" style="background-color: rgb(255, 255, 255); table-layout: fixed; width: 900px;word-break:break-all;">
<tbody>
<tr>
<td class="form-label" width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: center; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgb(255, 255, 255);">
安全措施
</td>
<td colspan="8" width="584" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);">
1.驻站联络员按规定时间到达车站,及时做好相关准备工作
2.在工作中严格执行标准化用语,必须讲普通话,做到口齿清晰、复诵正确。
3.出工前带齐工料具,计划,行车防护记录,印章,袖标,证件,确保齐全。
4.熟悉封锁、停电范围。
5.认真办理封锁、停电手续,核对调度命令正确无误后方可传达命令。
6.认真办理封锁、停电手续,核对调度命令正确无误后方可传达命令
7.驻站联络员作业期间坚守岗位,精力集中,及时、准确、清晰地传递行车信息和信号;作业过程中每3到5分钟与现场防护人员联系一次,确保联系畅通;作业未销记前,不得擅离工作岗位。
8.站场作业与电务保持联系动道岔及时联系工作领导人。
9.每3-5分钟与现场进行一次联系,确保联系畅通。
10.作业未销记前,不得擅离工作岗位。

</td>
</tr>
<tr>
<td class="form-label" width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: center; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgb(255, 255, 255);">
完成情况
</td>
<td colspan="8" width="584" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);"/>
</tr>
<tr>
<td class="form-label" width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: center; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgb(255, 255, 255);">
乘车方式及上下道口
</td>
<td colspan="8" width="584" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);">
去乘:粤BZ7099,上道口:光深间276#~加油站(陈仁源、陈榕飞)、返乘:粤BZ7099,下道口:光深间276#~加油站(陈仁源、陈榕飞)
</td>
</tr>
<tr>
<td class="form-label" width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: center; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgb(255, 255, 255);">
未处理缺陷记录
</td>
<td colspan="6" width="438" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);"/>
<td class="form-label" width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: center; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgb(255, 255, 255);">
质检员
</td>
<td width="73" style="color: rgb(34, 34, 34); padding: 2px 2px; border: solid 1px rgb(64, 64, 64); font-family: "simsun", serif; text-align: left; height: 26px; font-size: 14.667px; font-weight: 400; background-color: rgba(0, 0, 0, 0);"/>
</tr>
</tbody>
</table>

</body>
</html>


我已经固定了table的宽度与td的宽度,俩个table的单元格为什么还被撑宽了。但是把第2个table删除了,又正常了。

我现在要实现导出到excel就是A4左右的宽度,表格不能被撑宽。只可以拉高。请问如何解决。
...全文
490 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

39,084

社区成员

发帖
与我相关
我的任务
社区描述
HTML5是构建Web内容的一种语言描述方式。HTML5是互联网的下一代标准,是构建以及呈现互联网内容的一种语言方式.被认为是互联网的核心技术之一。
社区管理员
  • HTML5社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧