Microsoft.Office.Interop.Word.ApplicationClass AC = new Microsoft.Office.Interop.Word.ApplicationClass(); FileUpload1.SaveAs(Server.MapPath(FileUpload1.FileName)); object objFile = Server.MapPath(FileUpload1.FileName); object objNull = System.Reflection.Missing.Value; object objReadOnly = true; //Open Document Microsoft.Office.Interop.Word.Document Doc = AC.Documents.Open(ref objFile, ref objNull, ref objReadOnly, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull); int i = 1; foreach (Microsoft.Office.Interop.Word.Paragraph objParagraph in Doc.Paragraphs) { try { TextBox1.Text += Doc.Paragraphs[i].Range.Text; } catch (Exception ex) { throw ex; } i++; } AC.Quit(ref objNull, ref objNull, ref objNull);
Quote:If all the clients that are browsing the site are going to have Word installed and use Internet Explorer, you could embed it with an ActiveX object[^]. If these requirements are not met you might need to convert it to some more standard format that a browser is capable of displaying such as a jpeg image. You may also look at this option[^].
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)