Home > Forum > Actions > Generating Word documents in preview

Generating Word documents in preview
0

Hello,

In 2020 version of Webcon when using "Generate/Update a Word File" action, there was a checkbox "Show on screen" on the Output tab.
We were using this option in one aplication to show generated file to a user in a preview mode.
After upgrading to version 2021, the option was changed to "Download after file generation" which causes automatic file download without option to quickly preview the document and print it.
Is there a possibility to get that previous functionality in version 2021 ?

Thanks.

MVP

Hi jp,

I'm not aware of such an option. But you can achieve a similar result using the following configuration. The numbers referes to the screenshots in the image

1. Create the document and save it as an attachment
2. Save the id of the created attachment
3. Add a hyperlink action with this configuration, where {34} is the field in which you stored the id, or better a business rule which returned the value. In WEBCON BPS 2022 I would use an automation with a local parameter instead of a field.
javascript:var url = '/api/nav/db/{DBID}/attachments/{34}/preview?hash=0';var params = 'scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=400,height=600';window.open(url, '', params);

The last one will open document preview in a popup, in a defined width, height and optionally a position. If you want to use a more sophisticated version you could check out.
https://daniels-notes.de/posts/2022/add-new-choice-field-value-without-leaving-the-page#popup-creation-script
Replace ccls.popup.openNewWorkflowInstance with something like ccls.popup.showAttachment and call this function in the hyperlink instead of the above.


Best regards,
Daniel