Files
docx-js/demo/78-thai-distributed.ts

28 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-11-23 00:36:54 +00:00
// Simple example to add text to a document
2023-06-05 00:33:43 +01:00
2022-11-23 00:36:54 +00:00
import * as fs from "fs";
2023-06-05 00:33:43 +01:00
import { AlignmentType, Document, Packer, Paragraph, TextRun } from "docx";
2022-11-23 00:36:54 +00:00
const doc = new Document({
sections: [
{
properties: {},
children: [
new Paragraph({
alignment: AlignmentType.THAI_DISTRIBUTE,
children: [
new TextRun({
text: "บริษัท บิสกิด จำกัด (บริษัทฯ) ได้จดทะเบียนจัดตั้งขึ้นเป็นบริษัทจำกัดตามประมวลกฎหมายแพ่งและพาณิชย์ของประเทศไทย เมื่อวันที่ 30 พฤษภาคม 2561 ทะเบียนนิติบุคคลเลขที่ 0845561005665",
size: 36,
}),
],
}),
],
},
],
});
Packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
});