R – ASP.Net rich text edit control

asp.netms-wordrichtextbox

I am looking for control which could be used in ASP.Net, providing rich text editing function, like Office Live, Google Docs which could work on line. Another function needed is download into Microsoft Word format.

Any recommended ASP.Net built-in controls or samples/documents?

thanks in advance,
George

Best Answer

What about FCKeditor? It is not built in but it is one of the most capable editor.

You can get HTML from fckeditor control instance's Value property:

string s = fckeditor1.Value

Now save this string to a file say, MyPage.html. Now create an instance of MS World application and open this html file (myPage.html) with that application instance. Once opened you can save this opened file as word document! But this requires that you have MS office installed on machine:

private Word.ApplicationClass wordApp = new Word.ApplicationClass();

object fileName = ""; //Path to HTML File
object newFile = ""; //Path where you want to save doc file

bject missing = System.Reflection.Missing.Value;

Word.Document htmlDoc = WordApp.Documents.Open(ref fileName, ref missing, 
     ref readOnly, ref missing, ref missing, ref missing, ref missing, 
     ref missing, ref missing, ref missing, ref missing, ref isVisible);

object docFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocument;
   //Please check if this is correct value from enumeration

htmlDoc.SaveAs(ref newFile,ref docFormat, ref missing,ref missing,ref missing, 
     ref missing,ref missing,ref missing, ref missing,ref missing,ref missing, 
     ref missing,ref missing,ref missing, ref missing,ref missing);

htmlDoc.Close();
wordApp.Quit();

PS:- It has been long time worked with this please don't mind if you have to do bit of work before using this code and method.

Related Topic