FileStream fs = new FileStream(@"C:\My Downloads\BRD Issues.doc", FileMode.Open, FileAccess.Read);BinaryReader r = new BinaryReader(fs);byte[] bytes = new byte[fs.Length];for( long i = 0; i < fs.Length; i++) {bytes[] = r.ReadByte();}r.Close();fs.Close();someObject.docTemplate = bytes;************** I saved the word document, as byte[] in SQL Server 2000.************ I accessed that byte[] from SQL Server and trying to show in a new instance of MS-Word.
byte[] byteArrayObject = new byte[ChunkSize];// I called a service which gets the byteArray from SQL server, which it is stored in this object. From that i assigned that byte array to byteArrayObjectbyteArrayObject = someObject.docTemplate.byteTemplate1;
Response.Clear();Response.ContentType = "application/msword"; // or PDF !Response.AppendHeader("Content-Disposition", "attachment;filename=word.doc");Response.BinaryWrite(byteArrayObject);Response.Flush();Response.End();******************* The document is opened but shows some ascii format of text is displayed in MS-Word.. How i can achieve this..Kindly Help me out, this is my urgent assignment. Post a mail if possible..Please...Thanks in Advance..Phani[email protected]