DOCXKIT_MICROSOFT_URL_REQUIRED: Microsoft preview requires a URL
Microsoft Office Online preview requires a public HTTP(S) DOCX URL.
What to do
- Host the document at a publicly accessible HTTP(S) URL.
- For local blobs or private files, use the local docx-preview renderer.
Problem example
ts
import { createDocx, createDocxPreview } from 'docx-kit'
const container = document.createElement('div')
document.body.append(container)
const preview = createDocxPreview(container, { renderer: 'microsoft' })
try {
await preview.render(await createDocx().p('Hello').toBlob())
} finally { preview.destroy() }Corrected example
ts
import { createDocx, createDocxPreview } from 'docx-kit'
const container = document.createElement('div')
document.body.append(container)
// Local documents use the DOM renderer.
const preview = createDocxPreview(container, { renderer: 'dom' })
try {
await preview.render(await createDocx().p('Hello').toBlob())
} finally { preview.destroy() }Common causes
- Passing local bytes, a Blob URL, or a non-HTTP(S) URL to Microsoft preview.
Diagnostic fields
code:MICROSOFT_URL_REQUIREDdiagnosticCode:DOCXKIT_MICROSOFT_URL_REQUIREDname:DocxKitErrordocs: https://docx-kit.ntnyq.dev/errors/docxkit_microsoft_url_required/
Example message
text
Microsoft renderer requires a URL string