快速将excel/word表格转换为web页面(html)的方法

前言

在进行开发企业信息化建设的过程,应该有很多这样的场景,就是将现有的电子表格记录的方式转换为在数据系统中进行网页上报。也就是需要根据当前一直使用的表格制作一个上传这个表格信息的网页,如果要减少系统的使用学习成本,加上系统的数据字段没有什么变更,我们可以直接沿用表格的样式,就需要快速的根据这个表格来生成对应的网页。从而能快速的做出一个演示Demo。

生成

这里以这个施工日志表来进行一个转换演示:

在这里插入图片描述

这里使用了wps为编辑软件,不过office好像也可以,以excel为例子,直接另存为html文件即可:
在这里插入图片描述

用浏览器打开文件,效果如图:
在这里插入图片描述

在这里插入图片描述

转换后网页的代码如下(去除了style和部分注释):

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="ProgId" content="Excel.Sheet">
  <meta name="Generator" content="WPS Office ET">

 </head>
 <body link="blue" vlink="purple">
  <table width="1381.33" border="0" cellpadding="0" cellspacing="0" style='width:518.00pt;border-collapse:collapse;table-layout:fixed;'>
   <col width="136" style='width:51.00pt;'/>
   <col width="249.07" span="5" style='mso-width-source:userset;mso-width-alt:3985;'/>
   <tr height="36" style='height:13.50pt;'>
    <td height="36" width="136" style='height:13.50pt;width:51.00pt;'></td>
    <td width="249.07" style='width:93.40pt;'></td>
    <td width="249.07" style='width:93.40pt;'></td>
    <td width="249.07" style='width:93.40pt;'></td>
    <td width="249.07" style='width:93.40pt;'></td>
    <td width="249.07" style='width:93.40pt;'></td>
   </tr>
   <tr height="64" style='height:24.00pt;mso-height-source:userset;mso-height-alt:480;'>
    <td height="64" style='height:24.00pt;'></td>
    <td class="xl65" colspan="5" style='border-right:.5pt solid windowtext;border-bottom:.5pt solid windowtext;' x:str>施工日志</td>
   </tr>
   <tr height="36" style='height:13.50pt;'>
    <td height="36" style='height:13.50pt;'></td>
    <td class="xl66" x:str>工程名称</td>
    <td class="xl67" colspan="2" style='border-right:.5pt solid windowtext;border-bottom:.5pt solid windowtext;'></td>
    <td class="xl66" x:str>编号</td>
    <td class="xl68"></td>
   </tr>
   <tr height="36" style='height:13.50pt;'>
    <td height="36" style='height:13.50pt;'></td>
    <td class="xl66" x:str>施工单位</td>
    <td class="xl67" colspan="4" style='border-right:.5pt solid windowtext;border-bottom:.5pt solid windowtext;'></td>
   </tr>
   <tr height="36" style='height:13.50pt;'>
    <td height="36" style='height:13.50pt;'></td>
    <td class="xl69"></td>
    <td class="xl70" x:str>天气状况</td>
    <td class="xl70" x:str>风力<span style='mso-spacerun:yes;'>&nbsp;</span></td>
    <td class="xl70" x:str>最高/低温度</td>
    <td class="xl70" x:str>备注</td>
   </tr>
   <tr height="36" style='height:13.50pt;'>
    <td height="36" style='height:13.50pt;'></td>
    <td class="xl66" x:str>白天</td>
    <td class="xl68"></td>
    <td class="xl68"></td>
    <td class="xl68"></td>
    <td class="xl68"></td>
   </tr>
   <tr height="36" style='height:13.50pt;'>
    <td height="36" style='height:13.50pt;'></td>
    <td class="xl66" x:str>夜间</td>
    <td class="xl68"></td>
    <td class="xl68"></td>
    <td class="xl68"></td>
    <td class="xl68"></td>
   </tr>
   <tr height="45.33" style='height:17.00pt;mso-height-source:userset;mso-height-alt:340;'>
    <td height="45.33" style='height:17.00pt;'></td>
    <td class="xl71" colspan="5" style='border-right:.5pt solid windowtext;border-bottom:.5pt solid windowtext;' x:str>情况记录:(内容、作业、班组工作,存在的问题及处理情况等)</td>
   </tr>
   <tr height="373.33" style='height:140.00pt;mso-height-source:userset;mso-height-alt:2800;'>
    <td height="373.33" style='height:140.00pt;'></td>
    <td class="xl72" colspan="5" style='border-right:.5pt solid windowtext;border-bottom:.5pt solid windowtext;' x:str><font class="font3">(具体内容填入人员情况,设备情况,生产情况,质量安全工作记录,备注。然后交予工程师/建造师,或者业主,或者项目经理进行签字。需要注意的一点是,如果施工当天没有工作,必须也要填写施工日志,保持其连续性,不可后补,也不可修正。)</font><font class="font0"><br/><br/></font></td>
   </tr>
   <tr height="85.33" style='height:32.00pt;mso-height-source:userset;mso-height-alt:640;'>
    <td height="85.33" style='height:32.00pt;'></td>
    <td class="xl74" colspan="5" style='border-right:.5pt solid windowtext;border-bottom:.5pt solid windowtext;' x:str>技术质量安全工作记录:(技术质量安全活动,检查评定验收、技术质量安全问题处理情况等)</td>
   </tr>
   <tr height="506.67" style='height:190.00pt;mso-height-source:userset;mso-height-alt:3800;'>
    <td height="506.67" style='height:190.00pt;'></td>
    <td class="xl75" colspan="5" style='border-right:.5pt solid windowtext;border-bottom:.5pt solid windowtext;'></td>
   </tr>
   <tr height="36" style='height:13.50pt;'>
    <td height="36" style='height:13.50pt;'></td>
    <td class="xl66" x:str>记录人</td>
    <td class="xl78" colspan="2" style='border-right:.5pt solid windowtext;border-bottom:.5pt solid windowtext;'></td>
    <td class="xl66" x:str>日 期</td>
    <td class="xl67"></td>
   </tr>
   <![if supportMisalignedColumns]>
    <tr width="0" style='display:none;'>
     <td width="249" style='width:93;'></td>
    </tr>
   <![endif]>
  </table>
 </body>
</html>

从转换后的网页代码来看,个人觉得是没法直接使用到系统开发中的,因为比较冗长,而且可读性会差很多,如果熟练可以截取html元素进行后续开发。这个还是比较适用于基于现成表格的快速网页原型展示。

  • 24
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
如何将excel表格转换word文档.doc 如何将excel表格转换word文档? Excel强大的制表功能让很多办公一族都忘不了它的方便与实用。可是在一些情况下,我们必须将Excel表格转换Word文档。当前普遍的做法是:先用Excel做好表格,再把表粘到Word里。可是粘到Word里后表的格式全变了,还得重新进行调试,费时又费力。其实,完全可以按下述方法来轻松转换。   首先,用Excel编辑好一个表格,然后点击“文件”→“另存为web页”。web页就是网页文件,在“保存选项”处把“保存整个工作簿”调整成“选择:工作表”,把默认文件名“page.htm”根据实际情况改成你所需要的名字,如:“工作表.htm”,再点击“保存”。注意,在改名时绝对不可以把后面的.htm去掉,只要改“.”前面的部分就可以了。   找到刚才保存好的“工作表.htm”,如果你所安装的操作系统是WindowsXP或Windows2000,可以在文件上面直接点击鼠标右键,选择“打开方式”最下面的“打开程序”选项,在列表中找到“Word”,选中并确定。如果你所使用的操作系统是windows98,则操作方法略有不同,需要在“工作表.htm”上按住shift键的同时点击鼠标右键,之后再进行上述操作。   用Word程序打开该文件后,不要做任何编辑操作,直接点击“文件”→“另存为”,把文件名改成“工作表Word版”,把保存类型选成“Word文档”,再点击“保存”即可。   现在再打开刚才保存的“工作表word版”文件看看,是不是转换得很完美呢? Word表格处理技巧 Word表格处理技巧 1 文字巧妙转换表格 通常大家制作表格时,都是采用表格和边框工具来绘制表格,或者利用“表格→插入→表格”命令来定制表格,请问如已输入了文字,则有没有办法让文字快速产生表格呢? 答:有,可以用Word提供的表格与文字之间的相互转换功能完成。具体方法是这样: (1)按照自己的计划先将表格中的各项内容输入Word文件中,在这需注意的是,一定要利用一种特别的分隔符隔开准备产生表格列线的文字内容,该分隔符可以是逗号、制表符、空格或其他字符。 (2)选中需产生表格的文字内容,在菜单栏单击“表格转换→文本转换表格”命令,在弹出的对话框中的“文字分隔符位置”选项中选逗号(一定要和输入表格内容时的分隔符一致),同时按所要的表格形式对其他选项做适当的调整。 2 用“+”、“-”号巧制表格 表格制作一般的Word用户都会,但如果只利用键盘上的“+”号和“-”号来快速完成表格制作,可能很多朋友都不会,它的具体操作方法又是如何进行? 答:利用键盘上的“+”与“-”号制作表格,有时会给我们带来更高的效率。在制作前首先得明白“+”号表示下面将产生一列线条,而“-”号起到连线的作用,其具体制作方法是:首先在要插入表格的地方输入“+”号,用来制作表格顶端线条,然后再输入“-”号,用来制作横线(也可以连续输入多个“-”号,“-”号越多表格越宽),接着再输入一些“+”号(“+”号越多,列越多)。完成后再按回车键,便可马上得到一个表格。 小提示:用此方法制作出的表格只有一行,若需制作出多行的表格,则可将光标移到表格内最后一个回车符号前,按“Tab”键或回车键(Enter),即可在表格后插入行。 3 轻松微调行列宽度 在Word中制作表格时,有时需要对行列宽度进行一些微调,请问除了进行表格属性外,有没有其他更方便的方法呢? 答:在进行Word表格编辑时,如果要知道行或列的宽度,只需在按住鼠标左键调行的同时按下右键,标尺上(调整行时会在垂直标尺上显示,而在调整列时会在水平标尺上显示)就会显示出行或列的尺度。 小提示:此时表格标尺的精确度为0.01字符。 4 表格行列宽度调整技巧 表格在制作完成后常需进行一些调整,而在调整中有没有技巧呢? 答:技巧当然有,下面就给大家介绍一下如何对表格行列宽度进行调整的技巧。 首先选中要调整的行或列,并在选择区域上单击鼠标右键,在弹出菜单中选择“表格属性”选项,然后再根据实际情况

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

十幺卜入

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值