0

I'm looking for a solution in order to view a file (docx/xlsx format) in a webpage.

Before you send me to the google docs/online office/zoho viewer option, I've some restrictions:

a) no internet access b) no file storage c) file is in Base64 format d) no option to install a viewer, or any office suite e) there must be an option to download the file, from the viewer f) there's only HTML and Javascript available

I tried different approaches, and I tried to find a control that would allow this, but unsuccessfully.

Thank you

bluestrattos
  • 49
  • 1
  • 1
  • 12
  • Have you looked at http://oss.sheetjs.com/js-xlsx/ ? – SheetJS Aug 02 '14 at 18:37
  • Thanks @Nirk, it's an interesting option, but doesn't solve my problem, yet I saved it for future reference. My solution was converting the docx/xlsx to pdf, use Viewerjs (http://viewerjs.org/) as an online viewer, and then I added a button where the person can download the file in the original format (docx/xlsx). – bluestrattos Aug 05 '14 at 09:08
  • Why not just generate the PDF using headless openoffice on the server side, and just make both the PDF and the XLS file available? – SheetJS Aug 05 '14 at 21:16
  • I was searching for a solution that wouldn't require the intermediate step. I would prefer to display the original file docx/xlsx, rather having to convert to pdf and display it, and then add the option to download the file in the original format. – bluestrattos Aug 06 '14 at 10:40

1 Answers1

-1

It best to convert all your document to PDF just to be clear and with that just href="Location to file" Would open your file in a browser and same works for Image too.

You can also make use of ViewerJS if you like to things a it serious.