-1

I have a .docx file saved in assets folder. I have a textview with a button. When i click the button i want to display the .docx file in the textview of the same activity.I know to display .txt file,but how to display .docx file. I do not want to make use of Intent.ACTION_VIEW or olivedoclibrary. .docx may contain anything like images ,text everything.It should display the docx file as it is.

Coded that i founded was not properly understood.Please help What would be the solution to this problem atleast the explanation to the problem.

Please help

link
  • 35
  • 7
  • 1
    possible duplicate of [how to Show or Read docx file](http://stackoverflow.com/questions/10447865/how-to-show-or-read-docx-file) – kevinpelgrims May 16 '15 at 10:02
  • Refer this link http://stackoverflow.com/questions/15697784/displaying-a-ms-word-file-in-viewsay-textview-in-android Thanks – Hardik Parmar May 16 '15 at 11:35
  • I saw that,but i do not want to use olivedoclibrary – link May 16 '15 at 11:41
  • 1
    Possible duplicate of [Android Microsoft Office Library (.doc, .docx, .xls, .ppt, etc.)](http://stackoverflow.com/questions/4854947/android-microsoft-office-library-doc-docx-xls-ppt-etc) – JosephH Dec 31 '15 at 03:00

1 Answers1

2

When i click the button i want to display the .docx file in the textview of the same activity.

First, Android does not have a DOCX parser. You will need to find a third-party library that offers this (or write your own), then use something like a SpannableStringBuilder to build up the content to show in the TextView.

Second, TextView has support for limited formatting. Lots of things may be in a DOCX file that cannot be shown in a TextView.

You may have somewhat better luck finding a DOCX->HTML converter and showing the results in a WebView though even that may not rise to the level of "It should display the docx file as it is".

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • If not .docx, any other way of displaying .docx file content by converting the .docx file – link May 16 '15 at 10:51