[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.

So sorry for the very delayed reply but I was working on something else and have only just got back to this, my apologies.  And thank you all for your replies, it's very much appreciated!

The width and height won't take the 'px', it accepts numerical characters only.  And I have no idea what I should be entering as the file type as it is just a text data type and not a static entity.  However I have looked at the oml that Rui very kindly shared and copied the file type from that after opening a Word doc (which is what type of file I'm working with), and the information on the Submit makes sense, but I still cannot get mine to work.

I am also trying it out in another scenario whereby a link opens a new webscreen that should display a Word file on the server.  However this is the result....

This is from the preparation (the Download server action downloads a file from Sharepoint and returns the filepath on the server where the file is downloaded to, along with the file's content in binary form)...

I got it working in the end.  For anyone else struggling, see: