Show .doc inside div

You can display pdf inside a div using this:

<div>
    <object data="test.pdf" type="application/pdf" width="300" height="200">
    PDF : <a href="test.pdf">test.pdf</a>
    </object>
</div>

Is it possible to do something similar for .doc or .docx? (without server side)

  • I assume that the browser or computer has a way to read data.
+5
source share
2 answers

Perhaps I suggest Google Doc Viewer, this will allow you to show several types of embedded files, where download is usually requested:

https://docs.google.com/viewer/

You can also use this inline on your own website using iframe.

The following is a list of supported file types:

  • Microsoft Word (.DOC and. DOCX)
  • Microsoft Excel (.XLS and .XLSX)
  • Microsoft PowerPoint (.PPT and .PPTX)
  • Adobe Portable Document Format (.PDF)
  • Apple Pages (.PAGES)
  • Adobe Illustrator (.AI)
  • Adobe Photoshop (.PSD)
  • Tagged Image File Format (.TIFF)
  • Autodesk AutoCad (.DXF)
  • (.SVG)
  • PostScript (.EPS,.PS)
  • TrueType (.TTF)
  • XML (.XPS)
  • (.ZIP .RAR)

PDF , , - . , , .

+4

iframe div, .

<div>
<iframe src="mydoc.docx">myDocument</iframe>
</div>

<div>
<iframe src="mydoc.xslx">myDocument</iframe>
</div>

<div>
<iframe src="mydoc.pdf">myDocument</iframe>
</div>
+2

All Articles