0

can i make html editor of asp.net ajax 2.0/3.5 to read a rtf file from a directory?

can i if yes then how please?

David
  • 208,112
  • 36
  • 198
  • 279
C J
  • 429
  • 1
  • 10
  • 34

1 Answers1

1

Yes, first; read file content.

// Specify file.
FileStream file = new FileStream(Server.MapPath("~\\files\\test.rtf"), FileMode.OpenOrCreate, FileAccess.Read);
StreamReader sr = new StreamReader(file);

// Read contents of file into a string
string cval = sr.ReadToEnd();

// Second; Set Content property of HTMLEditor.
htmlEditor.Content = cval;

// Close StreamReader
sr.Close();

// Close file
file.Close();
Ahmed Atia
  • 17,848
  • 25
  • 91
  • 133
  • ��ࡱ�����������������>�������������������9 when i convert it is showing me this type of data can u help i think space is encoded in this type of ascii – C J Dec 15 '10 at 19:13
  • when i convert? what do you mean by convert? – Ahmed Atia Dec 15 '10 at 19:17
  • actully the file first was in docx file i uploaded the file and inserted it in sql server and retreive it in rtf file then i used html editor and displayed it in web from using ur code . – C J Dec 15 '10 at 19:29
  • So, the problem in not regarding HTMLEditor as i think, it's regarding file process logic (word --> SQL Server --> rtf). I don't know exactly where is the issue, but it's regarding file conversion. – Ahmed Atia Dec 15 '10 at 19:42