views:

562

answers:

2

Hello everyone,

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

+1  A: 

What about HTMl editor in Ajax Control toolkit. You can then get the content and save it as wod document. This thread has 2 links which had details about how to control HTML to word.

Shoban
"You can then get the content and save it as wod document." -- any reference samples or documents?
George2
There are many links in this thread, do you mean the following two links?http://www.ypgsoft.com/html2word/index.htm andhttp://htmltortf.com/index.php
George2
Yes thoe 2 links.
Shoban
HTMLEditor.content will give you the HTML content. use this to save it as doc(x) using the controls in above links.
Shoban
The controls you recommended is not free. I prefer to use either open source or .Net built-in controls, even functions are limited. Any comments or recommendations?
George2
+2  A: 

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.

TheVillageIdiot
Looks like only editing function, no export to MSWord function?
George2
I don't think there is any free or opensource product available for this until you want to dirty your hands with OpenXML. I once did a transformation from MS Word to HTML. I opened word document (Used Interop Assemblies for Office) and saved as html. You can open html document and save it as word. Give it a try till something more elegant is available.
TheVillageIdiot
"You can open html document and save it as word." -- you mean open manually or in programming way?
George2
Off course in *CODE* dear we are programmers ;)
TheVillageIdiot
I am confused. :-(You mean in "FCKeditor", there is function to export to MS Word? Could you clarify please?
George2
I've added some code hope this works for you. Please add reference to Microsoft World Object Library!
TheVillageIdiot
Thanks for your code, my current confusion is when/how could I use your code. My current idea is to add a Convert To MSWord button in the same page, and in the button click event handler, I will invoke your code. Is that a feasible solution? Any other ideas?
George2
sure when there is a postback on your button click you can take text from fckeditor and save it and do other stuff!
TheVillageIdiot
"postback on your button click" -- postback you mean end user click on button from browser? Why you say postback?
George2
yes on button click. the page is posted back from browser to server on button's click.
TheVillageIdiot
Cool, I will evaluate your solution and give you my feedback.
George2