2

I have a problem with google doc viewer for display xls file get from my server.

Currently when i try to display my xls file get from my server in my android app with a webview, i have a grey page with no preview available (I can download the xls from my server with the url). enter image description here

Sorry, I could not share link but It's like xxxx.com/123/DownloadExcel_GET?paraOne=%s&paraTwo=%s&paraThree=%s.

But when i try with xls exemple file in internet like http://lecompagnon.info/demos/demoxl3.xls , i don't have this problem. The xls is display succesfully.

Same it's working if i try with a googleDrive url like "drive.google.com/file/t/myfile/view?usp=sharing".

The only difference with the exemple file in internet and my file from my server, is the time to start the download. With the exemple file is instant, but with my xls i have to wait more than 10sec to start the download.

I think google doc viewer return no preview available, because for him 10sec to get the file is too long and he return a time out. But it's a supposition...

I found nothing about this problem, only this topic Google Document Viewer shows "No Preview Available" .

Here is my code :

String urlgoogle = "https://docs.google.com/gview?embedded=true&url=";

        String completeURL = urlgoogle + query;

        Log.i("completeURL", completeURL);
        wv.getSettings().setJavaScriptEnabled(true);
        wv.loadUrl(completeURL);
        //wv.loadUrl("https://docs.google.com/gview?embedded=true&url=" + "http://lecompagnon.info/demos/demoxl3.xls"); working
        wv.setWebViewClient(new WebViewClient() {
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return false;
            }
        });

edit I add more information. The grey page with no preview available not always showing, sometimes my xls file is display successfully the first time.

If i have the grey page, i can refresh, and after one or two refresh, the file is display. The refresh just call again the url in the webview

The file is dynamically create and generated from the serveur, this is why for download or get the file i must wait 10 sec.

Do Google doc viewer have a timeout if the time to get the file to display is too long ?

Community
  • 1
  • 1
Slasch
  • 275
  • 1
  • 6
  • 20
  • I'm seeing this exact behaviour. Smaller generated files open fine, but ones that take longer to generate time out with "No preview available". Did you find a solution to the problem? – Alex Blundell Feb 08 '16 at 14:01
  • 1
    I have same issue, have you resolved it. – Maheshwar Ligade Mar 04 '16 at 09:17
  • Yes, i solve the problem.i write a response – Slasch Mar 04 '16 at 10:19
  • The problem come for me from my webservice who create dynamically the xls file, and after return the document. But the treatment take time and googleDoc don't like that. So i decided to no create dynamically the xls file, but the file is already create when i call the WS. So the WS take less time to answer and google like it, now he display my document corretly. Hope it help – Slasch Mar 04 '16 at 10:24

0 Answers0