[Web Previewer] Nothing appears when previewing docx file

Forge Component
Published on 2018-11-19 by Rui Mendes
18 votes
Published on 2018-11-19 by Rui Mendes

I have an Upload widget and I copy the content of that widget to a file variable that is set as the file input parameter of the Web Previewer.  After doing a refresh on the Web Previewer there is nothing displayed, am I doing something wrong maybe?

There maybe something underlying wrong however as only the URL preview works in the sample component, everything else generates an error.  I'm working on Outsystems v10.

Hi Sienna,

I'm not the developer of Web Previewer, but maybe I can help. A common mistake with file upload is that the upload button's method is set as Ajax Submit instead of a normal Submit. This would result in what you describe; nothing is shown, because the binary isn't uploaded to the server. To get the binary on the server side, you need to set the Upload method to Submit.


Thanks for replying Lennart!

My button is already set to Submit unfortunately.  I can see in the debugger that the file passed has binary content.  It has no other parameters set other than the content though, does it require something else do you know?


Hi Sienna,

Can you post here a simple example on what you are doing. Btw that happen with all the docx or just with a specific one?



Hi Marcelo,

It happens with any docx.  I'm just doing it in a test module so there's nothing in there except the following...

Many thanks for your assistance!

Have you tried to set the file.fileType and the file.Filename ? because the component seems to use the file type and filename to know how to show the file

Hi Sienna,

Beside using the FileType and Filename try to use for width and height "200px" and "300px" instead.



Hi Sienna.

The solution to your scenario is a bit more complicated.

Simply put, here's what's happening with your example:
Using the Upload widget, the button must be set to Submit, so the data can be sent to the server. With a Submit request, there is a response which forces the screen to refresh. So, even if you set the variable with the data from the Upload widget it will be ignored because of that request/response.

To use the Upload within the context of the page, you can use the PopupUpload widget, which would handle the Submit request and prevent the original page from being refreshed.
Another scenario would be to save the uploaded file to the database and then have it available to use on the main page.

Attached is the implementation I think you are looking for.
Here's the runtime

Hope this helps.