在web视图显示Android的.doc文件? [英] Android Display .Doc File in WebView?

查看:138
本文介绍了在web视图显示Android的.doc文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,我有链接 http://mymobilece.com/api/api_getexammaterials的.php?ID = 28 , 我想查看的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 google document viewer,How to show it??

推荐答案

您可以使用JS的谷歌文档viever

you can use the js for google Doc viever

myScript="<html><iframe src='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");

您可以使用MyScript可作为字符串变量,并使用这个JavaScript code(请一定要仔细去除相当,如果高于code)和负载的WebView

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

    根据你的脚本宽度 - 高度变量 -
  • 您可以更改URL。
  • You can change the url - width- height variables according to your scripting.

这篇关于在web视图显示Android的.doc文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆