A browser javascript rewrite of the original python exporter
pnpm install
pnpm devClick the download button will generate a docx file with sample data inside main.js
pnpm buildThis will generate a dist folder with export-word-docx.js inside. Copy the file to ../Disfactory/backend/static/docx/export-word-docx.js so the Disfactory backend can serve it and include it with a script tag from /static/docx/export-word-docx.js.
<script src="export-word-docx.js"></script>And the exportWordDocx function will be available in the global scope.
const exampleData = [
{
sender: 'XXX',
serialNumber: '00000000',
location: '台北市中山區中山北路一段',
legislator: 'XXX',
townName: '台北市中山區',
imageUrls: [
// 'https://i.imgur.com/taKOy2v.png',
// 'https://i.imgur.com/LrUki4U.jpg',
],
},
];
await window.exportWordDocx(exampleData);MIT