ASP.Net富文本编辑控件

时间:2009-06-09 06:50:12

标签: asp.net ms-word richtextbox

我正在寻找可以在ASP.Net中使用的控件,提供丰富的文本编辑功能,如Office Live,可以在线工作的Google Docs。需要的另一个功能是下载到Microsoft Word格式。

任何推荐的ASP.Net内置控件或样本/文档?

提前谢谢, 乔治

2 个答案:

答案 0 :(得分:3)

FCKeditor怎么样?它不是内置的,但它是最有能力的编辑之一。

您可以从fckeditor控件实例的Value属性中获取HTML:

string s = fckeditor1.Value

现在将此字符串保存到文件中,例如MyPage.html。现在创建一个MS World应用程序的实例,并使用该应用程序实例打开此html文件(myPage.html)。 打开后,您可以将此打开的文件保存为word文档!但这需要您在机器上安装MS Office:

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: - 这已经很久了,请不要介意在使用此代码和方法之前是否需要做一些工作。

答案 1 :(得分:2)

Ajax Control工具包中的HTMl editor怎么样?然后,您可以获取内容并将其另存为wod文档。这个thread有2个链接,其中包含有关如何将HTML控制为单词的详细信息。