docx-to-content
ai-research-agent / extractor/url-to-content/docx-to-content
Extract
convertDOCXToHTML()
function convertDOCXToHTML(input, options?): Promise<string>
Converts a DOCX document to HTML
Parameters
Parameter | Type | Description |
---|---|---|
|
| DOCX input to convert |
| Conversion options |
Returns
Promise
<string
>
The converted HTML
Throws
If conversion fails
Example
const html = await convertDOCXToHTML('https://example.com/doc.docx');
const html = await convertDOCXToHTML(fileInput.files[0]);
Other
DocxOptions
Properties
imgPath?
optional imgPath: string;
Base path for image resources
includeStyles?
optional includeStyles: boolean;
Whether to include document styles
preserveShapes?
optional preserveShapes: boolean;
Whether to preserve shape elements
ParagraphStyle
Properties
alignment?
optional alignment: string;
Text alignment (left, right, center, justify)
indentation?
optional indentation: string;
Paragraph indentation
keepNext?
optional keepNext: boolean;
Keep with next paragraph
pageBreakBefore?
optional pageBreakBefore: boolean;
Force page break before
spacing?
optional spacing: string;
Line spacing
RunStyle
Properties
bold?
optional bold: boolean;
Bold text
color?
optional color: string;
Text color
font?
optional font: string;
Font family
highlight?
optional highlight: string;
Highlight color
italic?
optional italic: boolean;
Italic text
size?
optional size: string;
Font size
underline?
optional underline: boolean;
Underlined text
StyleConfig
Properties
block
block: boolean;
If true, element is rendered as block
class?
optional class: string;
CSS class name
element
element: string;
HTML element name
heading?
optional heading: boolean;
If true, element is a heading
xmlName?
optional xmlName: string;
DOCX XML element name