的WinForms HTML编辑器 [英] winforms html editor
问题描述
任何人都知道一个很好的免费的WinForms的HTML编辑器。NET的。理想情况下,我想HTML和preVIEW模式以及导出为PDF,Word文档或类似的可能性。
Anyone know of a good free winforms html editor for .NET. Ideally I would like html and preview modes along with the possibility of exporting to a pdf, word doc or similar.
虽然出口我大概可以从HTML输出创造自己。
Although the export I could probably create myself from the html output.
另一个不错的功能是从词,删除所有你通常最终与额外的标签贴合,但是这又是一个不错的不是必需的。
Another nice feature would be a paste from word that removes all the extra tags you usually end up with but again it's a nice to have not a required.
推荐答案
您可以使用设计模式中WebBrowser控件与第二WebBrowser控件在查看模式下设置的。
You can use the WebBrowser control in design mode with a second WebBrowser control set in view mode.
为了把在设计模式中WebBrowser控件,您可以使用下面的code。
In order to put the WebBrowser control in design mode, you can use the following code.
这code是一个超级精简版一个所见即所得的编辑器为我们的软件产品之一。
This code is a super stripped down version of a WYSIWYG editor for one of our software products.
只需创建一个新的形式,落个WebBrowser控件就可以了,把这个在Form_Load
Simply create a new form, drop a WebBrowser control on it, and put this in the form_load
Me.WebBrowser1.Navigate("about:blank")
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
这篇关于的WinForms HTML编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!