1

Im try to open files (inline mode) in browser. It's working fine for notepad and PDF files, but not for MS Office files(MS Word, MS Excel). For Ms office files I always get download screen in browser. Im using following code:

public FileStreamResult OpenDoc(string fileName, string contentType){
    Response.AddHeader("content-disposition", "inline; filename=" + fileName);
    return File(fileStreams, contentType);
}

Can you help?

A.R
  • 409
  • 8
  • 21
  • This depends on the browser configuration and Office / plugin installation. There is no code that spawns a Word instance in your browser, you need to configure the client PC to do that. – CodeCaster Aug 11 '14 at 10:44
  • What configuration you suggest in client PC? – A.R Aug 11 '14 at 10:47
  • Using [Chrome Office Viewer](http://chrome.blogspot.nl/2013/04/a-speedy-more-secure-way-to-view.html) for example. – CodeCaster Aug 11 '14 at 10:49
  • No, I need to open inline inside browser without any configuration changes – A.R Aug 11 '14 at 11:01
  • 1
    I thought Office applications stopped loading themselves in browsers a few versions ago. – CodeCaster Aug 11 '14 at 11:04
  • oh ok. Thanks. Im able to do it in a different way. Im getting file data in byte streams form and setting content type ="text/html" with content-dispostion="inline, filename="+filename So what Im doing Im passing bytes to browser without any specific application formats. – A.R Aug 11 '14 at 11:37

0 Answers0