close

How do I render a Word document (.doc, .docx) in the browser using JavaScript?

Hello Guys, How are you all? Hope You all Are Fine. Today we are going to learn How do I render a Word document (.doc, .docx) in the browser using JavaScript? in javascript. So Here I am Explain to you all the possible methods here.

Without wasting your time, Let’s start This Article.

How do I render a Word document (.doc, .docx) in the browser using JavaScript ?

  1. How do I render a Word document (.doc, .docx) in the browser using JavaScript ?

    do I render a Word document (.doc, .docx) in the browser using JavaScript I think I have an idea. This has been doing my nut in too and I'm still having trouble getting it to display in Chrome.

  2. do I render a Word document (.doc, .docx) in the browser using JavaScript

    do I render a Word document (.doc, .docx) in the browser using JavaScript I think I have an idea. This has been doing my nut in too and I'm still having trouble getting it to display in Chrome.

Method 1

The answers by Brandon and fatbotdesigns are both correct, but having implemented the Google docs preview, we found multiple .docx files that couldn’t be handled by Google. Switched to the MS Office Online preview and works likes a charm.

My recommendation would be to use the MS Office Preview URL over Google’s.

https://view.officeapps.live.com/op/embed.aspx?src=http://remote.url.tld/path/to/document.doc'

Method 2

I think I have an idea. This has been doing my nut in too and I’m still having trouble getting it to display in Chrome.

Save document(name.docx) in word as single file webpage (name.mht) In your html use

<iframe src= "name.mht" width="100%" height="800"> </iframe>

Alter the heights and widths as you see fit.

Summery

It’s all About this article. Hope all method helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you? Thank You.

Leave a Comment