cyntler / react-doc-viewer

File viewer for React.
https://cyntler.github.io/react-doc-viewer
Apache License 2.0
373 stars 125 forks source link

An error occurred We're sorry, but for some reason we can't open this for you. #259

Closed kamelabiad closed 3 months ago

kamelabiad commented 4 months ago

we are getting this error message when trying to view a docx file,

An error occurred We're sorry, but for some reason we can't open this for you. I have even tried to render it by making it public published through URL , but same issue

the file is attached . file-sample_1MB.docx

kamelabiad commented 4 months ago

And this is the code that we are using to render the file locally image

kamelabiad commented 4 months ago

@cyntler you support on this ticket is highly appreciated

cyntler commented 4 months ago

@kamelabiad Hey! Read the readme please: This library uses the official MS Office online document viewing service. This means it works on an iframe basis and only supports public file URLs! Therefore, it may not be compatible with all projects. Currently, there is no way to natively render MS Office documents in the browser.

In your case, you require() the file. It means the file is available on your site only and the require() function returns filename with extension, not public URL to this file. You have to provide full public URL with protocol to the library as uri to display DOCX.

There are a lot of issues regarding to MS Office files rendering. I think that the best way to resolve this problem is remove this functionality. ;)

It is very very problematic.