Getting started with TRichView

General TRichView support forum. Please post your questions here
Post Reply
PetterT
Posts: 12
Joined: Fri Mar 22, 2013 5:32 am

Getting started with TRichView

Post by PetterT »

Hi, I would appreciate your help to get started using TRichView.

In my database I have several blobs that contain HTML formatted text.
I need to convert the HTML in each blob to Native TRichView Format in order to use TRichView as primary editor and preview control.
Or perhaps there are other better ways to do this...?

Suggestions on steps to perform and possibly demos that shows this?

Best regards
Petter Topp
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Unfortunately, TDBRichViewEdit does not understand HTML. It can work with RVF (native format), RTF or a plain text.
However, you can use OnLoadCustomFormat to load HTML from DB to editor, and OnSaveCustomFormat to save HTML to DB.

For HTML loading, you need either rvHtmlImporter or rvHTMLViewImporter (better) components. The both are free, can be found in http://www.trichview.com/resources/

Sample code is:
http://www.trichview.com/forums/viewtopic.php?t=3197
PetterT
Posts: 12
Joined: Fri Mar 22, 2013 5:32 am

Post by PetterT »

Hi Sergey.

Just to be sure:

1. TRichView can't be used to convert HTML to RVF format?

2. And if using the rvHTMLImporter, I can only save the content of the editor back to HTML?

3. If I use the rvHtmlImporter to get the HTML content, can this content be edited using the RichView editor (wysiwyg)?

4. Do you have any other suggestion on how to convert the html content to rvf?

Petter
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

1. It can be used, but together with additional (free with source code) components. If HTML is simple, TrvHtmlImporter is enough. If this HTML uses CSS, you need to use TrvHtmlViewImporter (+ free THTMLViewer).

2. For saving to HTML, additional components are not required, TRichView has SaveHTMLEx method.

3. Yes. But it's important to understand, that the original HTML structure will not be kept. After loading and saving HTML, HTML code will be completely different (while visually the document should be the same, if it does not contain HTML features unsupported by TRichView)

4. rvHtmlViewImporter is currently the best solution.
PetterT
Posts: 12
Joined: Fri Mar 22, 2013 5:32 am

Post by PetterT »

I think the preferable way would be to convert HTML to RVF.

Given your answer in point 1. - I can import HTML using rvHtmlImporter, and save to database in RVF format?

And my HTML is simple no css is involved.

Petter
PetterT
Posts: 12
Joined: Fri Mar 22, 2013 5:32 am

Automate conversion from HTML to RVF

Post by PetterT »

I have tested the rvHTMLImport component, and it works just fine.

Now I'm about to make a utility that converts the html content in my database into RVF format as an automated one-time process.

How should I approach this without actually displaying the html content in RichView?

Br
Petter
Post Reply