Alcumus / react-doc-viewer

Apache License 2.0
208 stars 101 forks source link

docx and pptx files not loading #87

Open rajat-jain-au5 opened 3 years ago

rajat-jain-au5 commented 3 years ago

ss1 only this page showing

erkib commented 2 years ago

For Office files preview to work correctly, I discovered that the URI of the document has to be full URI and accessible to the rest of the world, because LIVE service is used to show the preview. Does your URI meet those requirements?

anthonygoodfynd commented 2 years ago

then what is the point of this? i can just write a node function to embed it myself and i wasted so much time to find out u cant load the most common doc types on earth?

MMahendra001ScaleTech commented 2 years ago

I am having the same issue here, it is giving us continuous loader and some short of cors error.

MMahendra001ScaleTech commented 2 years ago

Worked this way : Give fileType fileType: 'docx'

      const urlData = !!path ? [{ uri: path, fileType: 'docx' }] : [];

        <DocViewer
          className="doc-viewer"
          documents={urlData}
          config={{
            header: {
              disableHeader: false,
              disableFileName: false,
              retainURLParams: false,
            },
          }}
          pluginRenderers={DocViewerRenderers}
        />
gayathri138 commented 2 years ago

image xlsx ,csv,docx not displaying

erkib commented 2 years ago

You need a public URL to your documents for this component to work. Your picture already shows localhost, so no, it won’t show it.

viper4595 commented 1 year ago

Work like a charm. You save my night :)). Thank you

forhad-eng commented 1 year ago

image xlsx ,csv,docx not displaying

worked this way.

let urlData;

if(path){
    const ext = path.slice((path.lastIndexOf(".") - 1 >>> 0) + 2);
    if(ext === 'docx'){
        urlData = !!path ? [{ uri: path, fileType: 'docx' }] : [];
    }else if(ext === 'pdf'){
        urlData = !!path ? [{ uri: path, fileType: 'pdf' }] : [];
    }else if(ext === 'doc'){
        urlData = !!path ? [{ uri: path, fileType: 'doc' }] : [];
    }
}