前言
在進行開發企業信息化建設的過程,應該有很多這樣的場景,就是將現有的電子表格記錄的方式轉換為在數據系統中進行網頁上報。也就是需要根據當前一直使用的表格制作一個上傳這個表格信息的網頁,如果要減少系統的使用學習成本,加上系統的數據字段沒有什么變更,我們可以直接沿用表格的樣式,就需要快速的根據這個表格來生成對應的網頁。從而能快速的做出一個演示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;'> </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元素進行后續開發。這個還是比較適用于基于現成表格的快速網頁原型展示。