How to view the docx file in mobile app from database
Question
Application Type
Mobile

Hi,

How to view the docx file from database in mobile app. Is there any trick to pass the binary file in the URL parameter of OpenDocument action of file viewer plugin.


Hello Kaustubh,


You can try using File Plugin component to store the file in the device and then pass the FilePath of the file to the File Viewer Plugin.

https://www.outsystems.com/forge/component-overview/1633/file-plugin


Kind regards,

Bogdan

mvp_badge
MVP

Hello there Kaustubh,

Hope you're doing well.


About OpenDocument action from the File Viewer Plugin, you also have the option to open a file given the Path parameter and not only using an URL:


So my suggestion would be to save the file directly in your device (for example in a temporary folder), using SaveFile action from the File Plugin.

And after that, use the resulting URI as the file path for your OpenDocument action.


Please check this component where this entire logic is implemented for a PDF file:

https://www.outsystems.com/forge/component-overview/9919/open-pdf-sample-mobile

With a couple changes (for example, change to the correct mimeType), it should also work for a DOCX file :)


Hope that this helps you!


Kind regards,

Rui Barradas

Hi Rui,

Thanks for the reply, I tried using your logic but I am getting an below error in SaveFile action.

I used the below logic where I am creating a directory and using a URl which we get from createDirectory in saveFile path parameter.

mvp_badge
MVP

Hello there Kaustubh,

Did you check the FormatFileName action in my example?

You need to remove the spaces from your document's name when you save it using SaveFile action. Unfortunately, as far as I can tell, it is a limitation when using that action.


Also, is there a particular reason for you to create a Directory? You may use some existing directories. Please check GetFilePath action in my example as well :)


Kind regards,

Rui Barradas

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.