Hi All,
I want to ask, how can I preview the file without download it? the file type can be in PDF/Word/Excel. And if you ok, please give me an example about how to do it.
Thank you
Regards,
Riesta
Hi Riesta,
There is a component called Reactive Web Previewer which allows you to preview documents in Reactive applications.
It also includes a Demo where you can test and see how to implement it.
Hope it helps.
Cheers,
João
João Marques wrote:
Hi Joao,
Can this be used for traditional web?
You can refer this.
https://www.outsystems.com/forums/discussion/65560/want-to-view-microsoft-excel-file-in-outsystems/
Samiksha
Samiksha Manekar wrote:
Above link is works for traditional app .
For Traditional Web, you can use the Web Previewer and you even have this sample to see how it works.
Hi Joao and Nordin,
I've try using web previewer, in this link, said "To preview Binary Data Files, set the File input parameter and keep the URL as an empty string (""). "
I already follow the instruction, but, why it's still error?
Thank You
Hi riesta,
You need to pass a parameter of the type Binary (the file itself) and it seems you are passing an id.
Is it like this ? But it's still error and warning.
Thanks
Now that I'm looking to the component it asks for an input of type File structure. That being said, when you hover the left side of the File parameter, you'll see a +.
Once you you click, it will expand into the attributes
Now you can fill the Filename, the Binary in the BinaryData parameter and on the FileType, you should fill the following depending on the type of document:
The types above are the mime types, these are some examples but you can search more on the internet about them.
But now the problem is, the file can't be preview.
FYI, if I view image file, it's work. but, if I view PDF/Word/Excel file, it can't.
Thank's
Have you set the parameter FileType with the values I mentioned according to the type as I mentioned above?
The parameter needs to be filled according to the type of the file.
Sorry for the late reply. I've assign it to be like this.
Which values do you have in the database on the table Attachment, on the attribute FileType for the files that you are failing to preview?
I failed to preview in PDF, Word and excel file type. If I preview in PNG file type, it's succes.
What I meant was that if it is not working for the other types of documents is because your FileType value is not a correct mime type.
Since you are filling the parameter from the database, you can check what you have in the database for the table Assignment. In order to do that, you right click the table Assignment on the tab and select option View Data:
When you do that, you will see the records you have in your table Attachment (in my screenshot empty but on your with results) and you can see if the FileType is correct according to the examples I showed you:
If your file is of type PDF, then your FileType field in the database should be application/pdf in order to work, and for the Excel and Word like I mentioned above.
This is the value of fileType in my database.
With empty values, it is not going to work, right?
Working with the sample, I manage to upload a PDF file and have it working as you can see on the image below (I just uploaded the file and then clicked on the name of the file):
So, if you are using the same code and it is only working for images, it is something to do with data.
I think now the best thing you can do is to debug and see which mime types work for your files.
I tried to preview not with the empty data. I tried preview with the attachment ID that have value in FileType from the DB. I already debug. And when I did it, the file type, binary and the file name can be detect and have a value. But, I don't know why in the web previewer in browser always show message "Unavailable preview" when I show PDF, word and excel file type.
Hii,
@riesta kristianti tannia
You can try below OML logic.