CBuilder/Delphi 的 HTML 编辑器 [英] HTML Editor for CBuilder/Delphi
问题描述
I need to find basic WYSIWYG HTML editor component for C++Builder 5 to let users to create some simple text that I will paste into existing HTML page template. Just a simple support to create links, add images, use headers/bold/italic.
You can drop a TWebBrowser on a form and enable designmode on it, like this:
// Delphi code..
(WebBrowser1.Document as IHTMLDocument2).designMode := 'on';
After executing the above line, the page will be editable. You can type extra text, delete, etc. If you want to make selections bold or insert images, you're going to have to add some buttons to program that. The cool thing is that you can do that either from Delphi (or C++ builder in your case) or you can add javascript on the page to edit itself.
The contents of the page can be retrieved from
(WebBrowser.Document as IHTMLDocument2).body.innerHTML;
Remember that (WebBrowser.Document as IHTMLDocument2) could be nil.
Anyway, I can imagine that there are components around that do all the work for you, which is probably a better route to take than reinventing the wheel.
这篇关于CBuilder/Delphi 的 HTML 编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!