Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/11/2012, 09:43
Avatar de DeivisAndres
DeivisAndres
 
Fecha de Ingreso: febrero-2012
Ubicación: Colombia
Mensajes: 305
Antigüedad: 12 años, 2 meses
Puntos: 41
Respuesta: abrir archivo con c#

Mira si tienes agragada la referencia Microsoft.Office.Interop.Word.Application en tu proyecto he intenta con estas dos formas para ver si te funciona:

1.
Código Javascript:
Ver original
  1. Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
  2. app.Visible = true;
  3. object visible = true;
  4. object fileName = @"C:\temp\sample.doc";
  5. object optional = System.Type.Missing;
  6. Microsoft.Office.Interop.Word.Document doc = app.Documents.Open(ref fileName, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional,ref optional,ref optional,ref optional,ref optional,ref optional,ref optional);

2.
Código Javascript:
Ver original
  1. string fPath = @"c:/abc/doc/abc1.doc";
  2. FileInfo myDoc = new FileInfo(fPath);
  3. Response.Clear(); Response.ContentType = "Application/msword";
  4. Response.AddHeader("content-disposition", "attachment;filename=" + myDoc.Name);
  5. Response.AddHeader("Content-Length", myDoc.Length.ToString());
  6. Response.ContentType = "application/octet-stream";
  7. Response.WriteFile(myDoc.FullName);
  8. Response.End();

Espero y te sirva.