将assets文件夹中的.docx文件加载到webview中

时间:2022-02-23 00:26:07

I have a file "info.docx" placed in Android assets folder. I need to load/display this file in webview. Is it possible? I tried urlWebView.loadUrl("file:///android_asset/info.docx"); but it displays a blank screen. Please help.

我有一个文件“info.docx”放在Android资源文件夹中。我需要在webview中加载/显示这个文件。可能吗?我试过urlWebView.loadUrl(“file:///android_asset/info.docx”);但它显示一个空白屏幕。请帮忙。

1 个解决方案

#1


0  

WebView doesn't display Office documents. You can launch an intent for opening a doc file (see Android how to open a .doc extension file?), but the file itself in this case must reside in some location which is accessible to other apps (the assets of your file are not accessible to other apps).

WebView不显示Office文档。您可以启动打开doc文件的意图(请参阅Android如何打开.doc扩展名文件?),但在这种情况下,文件本身必须位于其他应用程序可访问的某个位置(文件的资源不是其他应用程序可访问)。

#1


0  

WebView doesn't display Office documents. You can launch an intent for opening a doc file (see Android how to open a .doc extension file?), but the file itself in this case must reside in some location which is accessible to other apps (the assets of your file are not accessible to other apps).

WebView不显示Office文档。您可以启动打开doc文件的意图(请参阅Android如何打开.doc扩展名文件?),但在这种情况下,文件本身必须位于其他应用程序可访问的某个位置(文件的资源不是其他应用程序可访问)。