Skip to content Skip to sidebar Skip to footer

Android Display .doc File In Webview?

In my app,I have link http://mymobilece.com/api/api_getexammaterials.php?id=28, I want to view in webview ,I try with google document viewer its work fine But i need it without go

Solution 1:

you can use the js for google Doc viever

myScript="<html><iframesrc='http://docs.google.com/gview?

url='http://mymobilece.com/api/api_getexammaterials.php?

id=28'&embedded='true'style='width:600px; height:500px;'frameborder='0'></iframe></html>"

mWebView = (WebView) findViewById(R.id.webview);
    mWebView.getSettings().setJavaScriptEnabled(true);

    mWebView.loadData(myscript,"text/html", "UTF-8");

you can use myscript as string variable and use this javascript code(please make sure to remove double quite if above code) and load in webview

  • You can change the url - width- height variables according to your scripting.

Solution 2:

Docs.google.com has a document parser , which basically parses MS-Office files , thats why you can view it on google docs. without that you will have to write document parser. Which will parse files and fetch the contents to display on view. In Short it will be not a good idea to do that. :)

Post a Comment for "Android Display .doc File In Webview?"