Page 1 of 1
Missing Demo in RvHtmlViewImporter v1.15.2
Posted: Mon Jul 18, 2016 5:37 am
by max.beliy
I'm trying to import to RV data with images from html, but can't do this. Text importing is ok, but fail with images.
May be demo will be helpful but the package "
RvHtmlViewImporter v1.15.2"
has no demo
Posted: Tue Jul 19, 2016 1:12 pm
by Sergey Tkachenko
The code for loading from file is very simple:
Code: Select all
if OpenDialog1.Execute then begin
HTMLViewer1.LoadFromFile(OpenDialog1.FileName);
RVHTMLViewImporter1.ImportHtmlViewer(HTMLViewer1, RichViewEdit1,
ExtractFilePath(OpenDialog1.FileName));
NormalizeRichView(RichViewEdit1.RVData);
RichViewEdit1.Format;
end;
The last parameter defines the base path for images and links. Probably, pictures were not loaded because it was not specified.
Note that the importer can automatically import only local images. If they are in the Internet (http-links), you need to import them yourself. You can do it in TRichView.OnImportPicture event.
If you use the importer in RichViewActions, and also activate support for Indy or CleverComponents, they can download images from http automatically.
Posted: Tue Jul 19, 2016 2:59 pm
by max.beliy
Thank, I also made as you have an example, but in my case the pictures were in base64 format inside html imgage tag, so the import of pictures doesn't work.
Do you plan to add support for base64 stored images in future ?
Posted: Tue Jul 19, 2016 7:35 pm
by Sergey Tkachenko
Yes, but not in very near future.
However, you can decode it yourself in OnImportPicture event.
Currently, we have an example only for encoding base64 when saving HTML:
http://www.trichview.com/forums/viewtopic.php?t=7191
But decoding is similar.
Write a decoded image in a stream, then load it to a graphic class using RVGraphicHandler.LoadFromStream method (RVGraphicHandler is a global variable defined in RVGrHandler unit) . This method autodetects graphic format by content. This method was added in TRichView v16.4.
If you use a trial of 16.0, you will be able to update it tomorrow, we are uploading the update.
Posted: Wed Jul 20, 2016 1:43 am
by max.beliy
Thanks