Tech Tip: Embed Documents in DataPages
You could embed a variety of documents in your details pages similar to the way you can embed an image. With this method you can embed the following file types at this time:
- Microsoft Word (.DOC and .DOCX)
- Microsoft Excel (.XLS and .XLSX)
- Microsoft PowerPoint (.PPT and .PPTX)
- Adobe Portable Document Format (.PDF)
- Apple Pages (.PAGES)
- Adobe Illustrator (.AI)
- Adobe Photoshop (.PSD)
- Tagged Image File Format (.TIFF)
- Autodesk AutoCad (.DXF)
- Scalable Vector Graphics (.SVG)
- PostScript (.EPS, .PS)
- TrueType (.TTF)
- XML Paper Specification (.XPS)
- Archive file types (.ZIP and .RAR)
This method requires the files to be outside of the database. If your files are not sensitive in nature, you can utilize Caspio’s High Usage FileStor to have your uploaded files automatically moved to a web space.
In this example we setup a table with two Text-255 fields, one for the link to the file and the other for its description.
Then create a Report. For our example we choose a direct-to-Details report.
On the next screen enable Advance Options and Parameters.
You can setup your search form any way you want. We will be displaying the file descriptions in a listbox. This is how we configured it.
And finally we get to the details page where we embed our PDF files. Here we insert an HTML block and paste the code below into the HTML block. This code uses Google Doc Viewer. The only modification necessary is the field name. Change the highlighted filename “Attachment” to whatever your field name that contains the URLs is called. You could also change the height and width of your embedded viewer.
Now deploy your DataPage on your website. Ours looks like this.