Open rajat-jain-au5 opened 3 years ago
only this page showing
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?
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?
I am having the same issue here, it is giving us continuous loader and some short of cors error.
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}
/>
xlsx ,csv,docx not displaying
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.
Work like a charm. You save my night :)). Thank you
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' }] : [];
}
}