Open microsoft Word

Is there any way to open un microsoft word file from a link html.? I am trying this , but always that the user click on the link . it start to download. I need thar open then microsoft office which is installed localy
I have tried with this

   header('Content-type: application/msword');
  header("Content-Length: ".filesize($arquivo)); 
  header("Content-Disposition: attachment; filename=".basename($arquivo)); 
  readfile($arquivo);

Change this
header(‘Content-Type: application/msword’);
to
header(‘Content-Type: application/octet-stream’);

And change
header("Content-Disposition: attachment; filename=".basename($arquivo));
to
header("Content-Disposition: attachment; filename=\".basename($arquivo)\" ");

I am no genius.
I found the MAYBE solution here:

header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Disposition: attachment;filename="' . basename($arquivo) . '"');

I have try this code but it doesn`t work. It show the donwload window

Why not make a Grid->Application of the $arquivo file and set the Initial Module to be Word. Then link to that?

It show the download window because you don’t have a web extension able to handle the word document like you have Acrobat reader for PDF. The header is only there to prevent file conversion to binary.

If you only need to display the Word Document, but don’t need to edit it, you can use Microsoft Office Viewer or Google Documents’ Viewer via an <iframe> to display a remotely hosted .doc /.docx .

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=http%3A%2F%2Fieee802%2Eorg%3A80%2Fsecmail%2FdocIZSEwEqHFr%2Edoc' width='100%' height='100%' frameborder='0'>This is an embedded <a target='_blank' href='http://office.com'>Microsoft Office</a> document, powered by <a target='_blank' href='http://office.com/webapps'>Office Online</a>.</iframe>

More info at
https://stackoverflow.com/questions/27957766/how-do-i-render-a-word-document-doc-docx-in-the-browser-using-javascript

1 Like

I don’t understand well . can you explain it?
thanks

2021-04-18 17_28_08-Window