任何人都知道一个很好的.NET免费的winforms html编辑器。理想情况下,我希望html和预览模式,以及导出为pdf,word文档或类似的可能性。
虽然我可以从html输出中创建自己的导出。
另一个很好的功能是从word粘贴,删除所有额外的标签,你通常会结束,但同样,这是一个很好的没有一个必需的。
发布于 2008-10-17 23:13:54
可以在设计模式下使用WebBrowser控件,并在视图模式下设置第二个WebBrowser控件。
为了将WebBrowser控件置于设计模式,可以使用以下代码。
这段代码是我们其中一个软件产品的所见即所得编辑器的超级精简版本。
只需创建一个新表单,在其上放置一个WebBrowser控件,然后将以下代码放入Form.Load:
Me.WebBrowser1.Navigate("")
Application.DoEvents()
Me.WebBrowser1.Document.OpenNew(False).Write("<html><body><div id=""editable"">Edit this text</div></body></html>")
'turns off document body editing
For Each el As HtmlElement In Me.WebBrowser1.Document.All
el.SetAttribute("unselectable", "on")
el.SetAttribute("contenteditable", "false")
Next
'turns on editable div editing
With Me.WebBrowser1.Document.Body.All("editable")
.SetAttribute("width", Me.Width & "px")
.SetAttribute("height", "100%")
.SetAttribute("contenteditable", "true")
End With
'turns on edit mode
Me.WebBrowser1.ActiveXInstance.Document.DesignMode = "On"
'stops right click->Browse View
Me.WebBrowser1.IsWebBrowserContextMenuEnabled = False发布于 2011-09-22 05:54:46
//CODE in C#
webBrowser1.Navigate("about:blank");
Application.DoEvents();
webBrowser1.Document.OpenNew(false).Write("<html><body><div id=\"editable\">Edit this text</div></body></html>");
foreach (HtmlElement el in webBrowser1.Document.All)
{
el.SetAttribute("unselectable", "on");
el.SetAttribute("contenteditable", "false");
}
webBrowser1.Document.Body.SetAttribute("width", this.Width.ToString() + "px");
webBrowser1.Document.Body.SetAttribute("height", "100%");
webBrowser1.Document.Body.SetAttribute("contenteditable", "true");
webBrowser1.Document.DomDocument.GetType().GetProperty("designMode").SetValue(webBrowser1.Document.DomDocument, "On", null);
webBrowser1.IsWebBrowserContextMenuEnabled = false;发布于 2009-07-22 12:33:14
我正在考虑使用Lutz Roeder的Writer (著名的Reflector )。一个基本的超文本标记语言编辑器,完全用C#编写,原样提供源代码。在http://www.lutzroeder.com/dotnet/上可以找到它
https://stackoverflow.com/questions/214124
复制相似问题