Welcome to the JavaScript feedback portal. We’re happy you’re here! If you have feedback on how to improve the JavaScript, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

When I try using the documentEditor.open(blobFile) method it is throwing an error when using a blob file.

I am able to open the same document using the open button in the toolbar.

Here is the error I am seeing:

Cannot read properties of undefined (reading 'bodyWidgets')
TypeError: Cannot read properties of undefined (reading 'bodyWidgets')
    at Selection.getDocumentStart (http://localhost:3000/static/js/bundle.js:213819:46)
    at DocumentEditor.get [as documentStart] (http://localhost:3000/static/js/bundle.js:146432:31)
    at DocumentHelper.onDocumentChanged (http://localhost:3000/static/js/bundle.js:260373:51)
    at DocumentEditor.open (http://localhost:3000/static/js/bundle.js:147461:29)

To recreate just open any docx file in blob form.

Here's an example to convert to blob file from an input field:

const handleFileChange = event => {
    const file = event.target.files[0]
    const reader = new FileReader()

    reader.onloadend = () => {
      const blob = new Blob([reader.result], { type: file.type })
      // Now you can use the blob
      documentEditor.open(blob)
    }

    reader.readAsArrayBuffer(file)
  }

<input type="file" onChange={handleFileChange} />