Online Documents
繁體中文
繁體中文
  • First Launch Experience
  • How to Train EMILY?
  • Simple Web Automation
  • Web Automation Tools
  • Web Automation Processor
  • User Fill
  • Workspace Script
  • File Exporter
  • File Enumerator
  • EXCEL Processor
  • EXCEL Analyzer
  • EXCEL Writer
  • EXCEL Filler
  • CSV Creator
  • PowerShell
  • PDF Analyzer
  • Mail Sender
  • Mail Reader
  • Exchange Mail Sender
  • Exchange Mail Reader
  • HTTP Analyzer
  • Command Line
  • DOCX Templater
  • SQL Executor
  • Desktop Automation (DA)
  • SFTP
  • JSON API Server
  • Chart
  • DOCX2HTML
  • Folder Processor
  • Google Drive
  • Google Sheets
  • Google OCR
  • Google NLU
  • Azure Form Recognizer
  • Anti-Captcha
  • ChatGPT
  • Gemini
  • Schedule Trigger
  • Mail Trigger
  • File Trigger
  • API Trigger
  • Protect Text
  • Flexibility & Security
  • Announcement
    • Version Releases
    • Third Party Notice
Powered by GitBook
On this page
  • 樣板DOCX TEMPLATE
  • input 輸入物件
  • output 輸出物件

DOCX Templater

利用 DOCX/PPTX 檔案樣板產生動態內容的 DOCX/PPTX 檔案

PreviousCommand LineNextSQL Executor

Last updated 2 years ago

樣板DOCX TEMPLATE

用來產生動態內容的 DOCX/PPTX 樣板檔案,點擊 PICK 選取或使用 %FILENAME% 變數。樣板檔案的編寫與輸出:

文字樣板:以前後百分比符號%夾變數名稱,例如 %title%,可以在文字樣板上套用文字樣式。

陣列樣板:陣列開頭以 %#陣列名稱% 表示,結尾以 %/陣列名稱% 表示,陣列中每筆資料物件的鍵值以文字樣板 %鍵值% 表示;當在表格中塞入陣列樣本,表格會按照陣列資料長度自行往下新增表格列,如果希望在文本中自動換行可以將陣列結尾符號換行。

圖片樣板:以前後百分比符號%夾變數名稱,變數名稱要以 img. 開頭,例如 %img.chart1%。

input 輸入物件

在 input 物件中的每個 key 為工作資料夾中的一個 TXT 檔案名稱(不包含副檔名),每個 value 為該檔案的文字內容。

// 讀取工作資料夾中 title.txt products.txt 的值
let title = input['title']
console.log('title:', title)

let products = JSON.parse(input['products'])
console.log('products:', products)

output 輸出物件

對應到 DOCX/PPTX 樣板檔案內容中的變數 %key%,output 物件必須指定 output[‘key‘] 的 value;對應到 DOCX 樣板檔案內容中的陣列變數 %items%,output 物件必須指定資料陣列至 output[‘items‘] 的 value:

// DOCX 樣板檔案中定義了 %title% 與 %#products% %name% %amount% %price% %/products%
output['title'] = title
output['products'] = products

// 插入工作資料夾中的 PNG 檔
output['img.chart1'] = 'chart1.png'
樣板
輸出結果