Skip to content

DOCXKIT_MICROSOFT_URL_REQUIRED: Microsoft preview requires a URL ​

Microsoft Office Online preview requires a public HTTP(S) DOCX URL.

What to do ​

  1. Host the document at a publicly accessible HTTP(S) URL.
  2. 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 ​

Example message ​

text
Microsoft renderer requires a URL string

Released under the MIT License.