0

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

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

提前谢谢,乔治

4

2 回答 2

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

于 2009-06-09T07:10:01.120 回答
2

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

于 2009-06-09T06:57:36.293 回答