What problem does it solve?
This Skill streamlines the creation, editing, and analysis of Word documents, allowing you to quickly produce professional documents with minimal effort.
Core Features & Use Cases
- DOCX Creation: Generate new Word documents with JavaScript and docx-js, including formatting like tables of contents, headings, and page numbers.
- Editing Existing Documents: Edit Word documents directly through XML manipulation, including tracked changes and comments.
- Data Extraction and Conversion: Extract text and convert .doc files to .docx format.
- Use Case: Imagine you need to create a detailed report with a table of contents. Use this Skill to generate the document structure using JavaScript and then edit the content and add tracked changes through XML manipulation.
Quick Start
To create a new Word document, run the following JavaScript code:
const { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell, ImageRun, Header, Footer, AlignmentType, PageOrientation, LevelFormat, ExternalHyperlink, TableOfContents, HeadingLevel, BorderStyle, WidthType, ShadingType, VerticalAlign, PageNumber, PageBreak } = require('docx');
const doc = new Document({ sections: [{ children: [/* content */] }] });
Packer.toBuffer(doc).then(buffer => fs.writeFileSync("doc.docx", buffer));