Add install-word-addins.ps1 script

This commit is contained in:
oom 2026-10-29 16:15:54 +07:00
parent b1449ab668
commit bc61f0fd2e
3 changed files with 157 additions and 31 deletions

View file

@ -15,7 +15,7 @@ export default function HomePage() {
const handleTmplSelect = (template: string, data: string) => {
//console.log('Location Selected:', { template, data });
};
const handleInput = (e: ChangeEvent<HTMLInputElement>)=>{
const handleInput = (e: ChangeEvent<HTMLInputElement>) => {
// console.log(e.target)
return true;
}
@ -24,8 +24,8 @@ export default function HomePage() {
<div className="p-8 max-w-md mx-auto space-y-8 bg-gray-50 min-h-screen">
<h1 className="text-xl font-bold text-center">ตัวอย่างการใช้ สร้างเอกสารจาก Template</h1>
<div>
ตัวอย่าง Frontend ส่งข้อมูลผ่าน &lt;form&gt;(POST) หรือ &lt;a&gt;(GET)
เพื่อรองรับ Vanilla JavaScript และ Classic Framework ใช้การเปลี่ยนหน้าเพื่อดาว์นโหลดไฟล์
ตัวอย่าง Frontend ส่งข้อมูลผ่าน &lt;form&gt;(POST) หรือ &lt;a&gt;(GET)
เพื่อรองรับ Vanilla JavaScript และ Classic Framework ใช้การเปลี่ยนหน้าเพื่อดาว์นโหลดไฟล์
ตัวอย่างหน้าแบบ <Link href='/tmpl/dl.html'>Plain HTML</Link>
</div>
<div className="p-4 border rounded-xl bg-white shadow-sm">
@ -35,10 +35,10 @@ export default function HomePage() {
label1="Template(tid):" label2="ข้อมูล(fid):" onSelectChange={handleTmplSelect} />
<div className="mb-2"></div>
<div>
uid:<input type="text" name="uid" className="p-2 mb-2 border border-gray-300 rounded-md" defaultValue="john"/>
uid:<input type="text" name="uid" className="p-2 mb-2 border border-gray-300 rounded-md" defaultValue="john" />
</div>
<div>
uname:<input type="text" name="uname" className="p-2 mb-2 border border-gray-300 rounded-md" defaultValue="John Doe"/>
uname:<input type="text" name="uname" className="p-2 mb-2 border border-gray-300 rounded-md" defaultValue="John Doe" />
</div>
<button
type="submit"
@ -57,45 +57,56 @@ export default function HomePage() {
</div>
<div className="p-4 border rounded-xl bg-white shadow-sm">
<h2 className="font-semibold text-blue-600 mb-2">A Link Get(new)</h2>
<Link href="/api/template/download-docx?tid=T_X&fid=T_no_warning&uid=john&uname=John%20Doe">T_no_warning_john_xxx.docx</Link><br/>
<Link href="/api/template/download-docx?tid=T_X&fid=TF_no_warning_P2&uid=john&uname=John%20Doe">TF_no_warning_P2_john_xxx.docx</Link><br/>
<Link href="/api/template/download-docx?tid=T_X&fid=TS_P2_IN&uid=john&uname=John%20Doe">TS_P2_IN_john_xxx.docx</Link><br/>
<Link href="/api/template/download-docx?tid=T_X&fid=T_no_warning&uid=john&uname=John%20Doe">T_no_warning_john_xxx.docx</Link><br />
<Link href="/api/template/download-docx?tid=T_X&fid=TF_no_warning_P2&uid=john&uname=John%20Doe">TF_no_warning_P2_john_xxx.docx</Link><br />
<Link href="/api/template/download-docx?tid=T_X&fid=TS_P2_IN&uid=john&uname=John%20Doe">TS_P2_IN_john_xxx.docx</Link><br />
<Link href="/api/template/download-docx?tid=T12_X&fid=T12_b2_IN&uid=john&uname=John%20Doe">T12_b2_IN_john_xxx.docx</Link><br/>
<Link href="/api/template/download-docx?tid=T12_X&fid=T12_FD155_3s-long&uid=john&uname=John%20Doe">T12_FD155_3s-long_john_xxx.docx</Link><br/>
<Link href="/api/template/download-docx?tid=T12_X&fid=T12_b2_IN&uid=john&uname=John%20Doe">T12_b2_IN_john_xxx.docx</Link><br />
<Link href="/api/template/download-docx?tid=T12_X&fid=T12_FD155_3s-long&uid=john&uname=John%20Doe">T12_FD155_3s-long_john_xxx.docx</Link><br />
</div>
<div className="p-4 border rounded-xl bg-white shadow-sm">
<h2 className="font-semibold text-blue-600 mb-2">Template & Data</h2>
Template: <Link href="/tmpl/T_X.docx">T_X.docx</Link>, &nbsp;
<Link href="/tmpl/T12_X.docx">T12_X.docx</Link><br/>
<Link href="/tmpl/T12_X.docx">T12_X.docx</Link><br />
Data: <Link href="tmpl/TF_no_warning_P2.json">TF_no_warning_P2.json</Link>, &nbsp;
<Link href="/tmpl/T_no_warning.json">T_no_warning.json</Link>, &nbsp;
<Link href="/tmpl/TS_P2_IN.json">TS_P2_IN.json</Link><br/>
<Link href="/tmpl/TS_P2_IN.json">TS_P2_IN.json</Link><br />
<Link href="/tmpl/T12_b2_IN.json">T12_b2_IN.json</Link>, &nbsp;
<Link href="/tmpl/T12_FD155_3s-long.json">T12_FD155_3s-long.json</Link>
</div>
<div className="p-4 border rounded-xl bg-white shadow-sm">
<h2 className="font-semibold text-blue-600 mb-2">Flow</h2>
<div className="text-xl font-bold text-center">
หน้านี้(เลือกไฟล์)<br/>
&darr; <br/>
download-docx(ตรวจสิทธิ์,ส่งเทมเพลต ID,ส่งข้อมูล)<br/>
&darr; <br/>
generate(เปิดเทมเพลต,สร้าง docx)<br/>
&darr; <br/>
ดาว์นโหลด docx เปิด MS Word อัตโนมัติ<br/>
&darr; <br/>
Add-ins ตรวจสอบไฟล์, ผู้ใช้แก้ไข docx<br/>
&darr; <br/>
Versioning(คุมเวอร์ชั่น)<br/>
&darr; <br/>
ecourt(อัปเดตฐานข้อมูลและไฟล์)<br/>
</div>
<div className="p-4 border rounded-xl bg-white shadow-sm">
<h2 className="font-semibold text-blue-600 mb-2">Flow</h2>
<div className="text-xl font-bold text-center">
หน้านี้(เลือกไฟล์)<br />
&darr; <br />
download-docx(ตรวจสิทธิ์,ส่งเทมเพลต ID,ส่งข้อมูล)<br />
&darr; <br />
generate(เปิดเทมเพลต,สร้าง docx)<br />
&darr; <br />
ดาว์นโหลด docx เปิด MS Word อัตโนมัติ<br />
&darr; <br />
Add-ins ตรวจสอบไฟล์, ผู้ใช้แก้ไข docx<br />
&darr; <br />
Versioning(คุมเวอร์ชั่น)<br />
&darr; <br />
ecourt(อัปเดตฐานข้อมูลและไฟล์)<br />
</div>
</div>
</div>
<div className="p-8 max-w-md mx-auto space-y-8 bg-gray-50 min-h-screen">
<div className="p-10 max-w-md border rounded-xl bg-white shadow-sm">
<h2 className="font-semibold text-blue-600 mb-2">Addin</h2>
ติดตั้ง Word Add-ins ด้วยสคริปต์นี้ <br/>
<Link href="/wordaddin/install-word-addins.ps1"> install-word-addins.ps1 </Link>
<br/>
ติดติดปัญหาบน Power Shell ให้เรียกสองบรรทัดล่างก่อน <br />
<p className="whitespace-nowrap">Unblock-File .\install-word-addins.ps1</p>
<p className="whitespace-nowrap">Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned -Force</p>
<p className="whitespace-nowrap">.\install-word-addins.ps1 -Install</p>
</div>
</div>
</div>
);
}