Javascript Open Content Type

In javascript, I have a line containing a SpreadsheetML file (excel xml)

I want to open a new window and write this data to it, but open it as excel.

Can I do this from javascript?

+4
source share
1 answer

Yes, you can do this with the data url . First encode the document as base64 . Then use the following URL as the source of your window:

var mtype = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; var url = 'data:' + mtype + ';base64,' + base64data; window.open(url); 

This will require a modern browser .

+3
source

All Articles