Processing
 

How to Show Word Document File in Browser instead of downloading Spring MVC?

19/09/2016 10:37#1

Ahmad

Member

Joined at: 11 months ago

Post: 73

Thank: 0

Thanked: 0

HI everyone i am doing file handling in my spring MVC Application, i need to display Word file (.doc, .docx) file in my browser instead of downloading..

i am using this code for displaying file in browser,..

response.setHeader("Content-Disposition", "inline; filename=\"%s\"",                     downloadFile.getName()"); 

with this code PDF, IMAGE File, and TXT Files are showing in browser but not word file,

can you please help me how to do this ? i have go through different solutions in stackoverflow and google but i cannot find any thing.

PS: i don't want google docs for displaying word file.

19/09/2016 11:03Top#2

chrylis

Member

Joined at: 9 months ago

Post: 3

Thank: 0

Thanked: 0

This is entirely up to the browser, most of which don't have built-in support for Word documents. You've already given it the hint, and it will decide how (or even whether) it can handle it.

The only other approach would be to use an inline JavaScript-based viewer, similar to the one that Google Docs does use, but that would change the nature of the response from "here is a file" to "here is a Web application that I'll preload with content".

Similar articles

VBA regex matching over two lines

5 months ago - Reply: 1 - Views: 44

Table output to Word-2011 from Rstudio using knit

5 months ago - Reply: 0 - Views: 44

Write a Collection of paragraphs into a new document

5 months ago - Reply: 1 - Views: 72

how to write paragraphs without show to document

5 months ago - Reply: 1 - Views: 67

numericals in word macro

5 months ago - Reply: 1 - Views: 46

Can not find proofing tools

5 months ago - Reply: 0 - Views: 2

Possible values for <w:outlineLvl> in Word OOXML

5 months ago - Reply: 1 - Views: 8

C# restrict editing partial word paragraph

6 months ago - Reply: 2 - Views: 146

Macro translation Please (possible virus)

5 months ago - Reply: 1 - Views: 35

Doc/Docx Fastest Reading Method for Searching

5 months ago - Reply: 0 - Views: 3

Save embedded file / content from word

5 months ago - Reply: 0 - Views: 6

Counting words in Word document, including footnores

5 months ago - Reply: 1 - Views: 24

c# access extract word ole object

5 months ago - Reply: 1 - Views: 23

Using word wildcards to find unaccepted changes

5 months ago - Reply: 1 - Views: 46

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re