I want to show docx file in my app.In one of the api calls the returned response contains url to a docx file.I just need to show that docx file and no edit.Can i directly open it via intent or should i first convert it into image file format and then show in imageview.
1 Answers
Can i directly open it via intent
You can try. Create an ACTION_VIEW
Intent
, pointing at the DOCX file. Wrap your startActivity()
call in a try
/catch
block, to catch ActivityNotFoundException
. If that is raised, there is no exported activity on the device that can handle your Intent
, so if your Intent
is set up properly, there is no DOCX viewer.
should i first convert it into image file format and then show in imageview
There is nothing in Android itself for converting DOCX into anything, let alone an image. Also, many DOCX files have more than one page, which means a single image file is unlikely to be useful. Either set up a server that can convert the DOCX into something (e.g., ZIP of HTML and images, PDF) that is more likely to be viewable on the device, or license some sort of DOCX viewing library (if one exists).

- 986,068
- 189
- 2,389
- 2,491
-
thanks for the reply..i got your point.Can webview work in this case? – Rajesh Gosemath Oct 10 '16 at 12:39
-
@Androidjack: `WebView` has no ability to view DOCX files itself. – CommonsWare Oct 10 '16 at 12:45