Page 1 of 1

Save RichView to Inlinehtml

Posted: Fri Nov 06, 2015 2:35 pm
by retwas
Hi

I would like to same the content of a TRichview (Text, CSS, Image) in only one html files, all inline.

Does it's possible ?

When I use SaveHTMLToStream I have linebreak..

Thanks

Posted: Fri Nov 06, 2015 2:56 pm
by Sergey Tkachenko
HTML and CSS are saved in a single file by default.
The problem is only with images, they are saved as separate files by default.

I can suggest the following solutions

1) Use a web archive format (MHT files), containing HTML and images.
MHT files can be opened by browsers like HTML files.
You can find the example in
http://www.trichview.com/forums/viewtopic.php?t=11
(the demo in Delphi\SaveFile folder)

or

2) You can store images just inside <img src>.
The syntax is like this:

Code: Select all

<img src="data:image/gif;base64,R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0j
vb29t/f3//Ub//ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAAAAAAQAA4AAA
Re8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0Cc
guWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7">
I.e. the format is: data:[<image type>][;base64],<image data>

Process OnSaveImage2, create the proper value for <img src>, assign it to Location parameter. I think that this feature will be added (as an option) in future versions of TRichView.