SaveHTML place images in images folder

General TRichView support forum. Please post your questions here
Post Reply
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

SaveHTML place images in images folder

Post by standay »

Hi Sergey,

I'm using this and it works fine:

Code: Select all

      memo.SaveHTML(FileSaveDialog1.FileName,
        ExtractFileName(FileSaveDialog1.FileName), 'img',[ rvsoUTF8] );
That's great, but I want the images in a subfolder relative to the html file itself. I've looked at SaveImage2 but can't figure out how to do this. It's probably very simple but I can't get it to work! If it involves using SaveImage2, can you post how I would call it and from where?

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

Re: SaveHTML place images in images folder

Post by Sergey Tkachenko »

ImagesPrefix parameter may include path, such as 'images\img'.
This folder must exist (create it before saving HTML).
After saving, I suggest calling RemoveDir() for this folder, it will remove it only if it is empty.

As a sample, you can see RichViewActions code (search for calls of SaveHTML in RichViewActions.pas).
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

Re: SaveHTML place images in images folder

Post by standay »

Thanks Sergey. I was hoping it was something as simple as that, it works great. I switched from SaveHTML to SaveHTMLEX as it works better. SaveHTML did not export paragraphs with background colors which is something I use frequently.

Stan
Post Reply