Page 1 of 1

save/load HTML stream containing custom fields (controls)

Posted: Thu Dec 01, 2005 7:12 am
by lwinter
Problem:
We have a text format that is essentially HTML, but with some references to custom fields. We want to be able to load this into the TRichViewEdit control and to have it instantiate up to 3 kinds of custom controls within the text, as well as creating simple HTML elements, like bold text or bullet points. The custom control will need to have 1 or 2 properties defined for them (eg. a label and content). We would also like to save the text in the same format as we loaded it (and using a stream in both instances).

We have looked at the options that appear to be available to us to do this and have seen that there is a RvHtmlImporter and TRichViewXML import/export. However, we cannot determine whether the above functionality is possible.

Question 1:
Is it possible to use a HTML component to load HTML that includes custom controls?

Question 2:
Is it possible to use a HTML component to save HTML that includes custom controls?

Question 3:
If it is possible to use XML to load and save contents, are there sample files that contain custom controls?

Example Custom HTML format:
Text in <b>bold</b> or <i>italic</i>,<p>
<ul>
<li>bullet point
</ul>
<CustomControl class="TCustomControl1" property1="Custom Control Label" property2="@some custom code@" />

Example in TRichView:
Text in bold or italic
• bullet point
Custom Control Label

Posted: Thu Dec 01, 2005 8:46 pm
by Sergey Tkachenko
You can save controls to HTML (XHTML) using OnSaveComponentToFile event.
No, you cannot load controls from HTML without modifying code of RVHtmlImporter.