Re: [閒聊] 近況 + JavaScript

作者: laechan (揮淚斬馬雲)   2020-03-16 21:42:06
最近又開始 javascript 的練習,下半年起我又會很忙,之前
在公司寫的東西也需要調整,所以趁現在有空,複習一下。
剛剛先寫了以下的東西
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<script src="xlsx.core.min.js"></script>
<script src="FileSaver.min.js"></script>
<script src="xlsx.full.min.js"></script>
<script type=text/javascript>
function read_files()
{
files=document.getElementById("files").value;
filters=document.getElementById("filters").value;
document.getElementById("show_results").innerText=
"files="+files+"\nfilters="+filters;
}
</script>
請選取一個 excel 檔案: <input type="file" id="files"><p>
請輸入篩選關鍵字: <input type="text" id="filters"><p>
<button id="buttons" onclick='read_files()'>讀取資料</button><p>
<table>
<tr><td id="show_results"></th></tr>
</table>
</html>
以上已經確認可 work。
主要想實驗,藉由給予的篩選關鍵字,去搜尋目標 excel 檔案內主要
sheet 的每一行,只要有 match 關鍵字的欄位,就把該行 show 出來
,這個明天起再 try 各種可行的做法。
一般來說透過 excel 的巨集也可以做到,不過巨集只靠自己研究實在
很難懂,還好 javascript 也有寫好的相關工具可用。
Laechan

Links booklink

Contact Us: admin [ a t ] ucptt.com