<< Click to display table of contents >> TCustomRichView.OnSaveImage2 |
Occurs when TRichView saves image to HTML, Markdown, or XML (by TRichViewXML component) file or stream.
type
TRVSaveImageEvent2 = procedure (Sender: TCustomRichView;
Graphic: TRVGraphic; SaveFormat: TRVSaveFormat;
const Path, ImagePrefix: TRVUnicodeString;
var ImageSaveNo: Integer; var Location: TRVUnicodeString;
var DoDefault: Boolean) of object;
property OnSaveImage2: TRVSaveImageEvent2;
(introduced in version 1.8; "hidden" parameters are added in version 14; changed in version 18)
For HTML, this event is alternative to OnHTMLSaveImage. It is more easy to use, because the image is available in the Graphic parameter (in OnHTMLSaveImage, you need to extract image from the item or RVData yourself). Besides, this event has ImagePrefix and ImageSaveNo parameters, so you do not need to store them in global variables.
For HTML, OnSaveImage2 is not called if:
▪rvhtmlsioUseItemImageFileNames is included in HTMLSaveProperties.ImageOptions and value of rvespImageFileName item property is not empty;
▪DoDefault parameter of OnHTMLSaveImage was set to False for this image.
For Markdown, OnSaveImage2 is not called if:
▪rvmdsoUseItemImageFileNames is included in the MarkdownProperties.SaveOptions and value of rvespImageFileName item property is not empty.
Input parameters:
Graphic – image to save.
SaveFormat is equal to rvsfHTML, rvsfMarkdown, or rvsfXML.
Path – destination directory of HTML or Markdown file (or Path parameter of SaveHTMLToStream/SaveMarkdownToStream)
ImagePrefix – recommended beginning of image file name (HTMLSaveProperties.ImagesPrefix or MarkdownProperties.ImagesPrefix)
ImageSaveNo – value that you can use to create unique file names (see GetNextFileName method in the description of OnHTMLSaveImage).
"Hidden" input parameters:
Sender.Style.RVData (must be typecasted to TCustomRVData) – document containing the item that is being saved to an image; it can be Sender.RVData, table cell, or RVData of cell inplace-editor.
Sender.Style.ItemNo – index of this item inside Sender.Style.RVData. If this event is called for background image (document or cell), ItemNo=-1.
Output parameters:
Location – set this parameter to file name of image where you saved it. This string will be inserted in HTML file.
DoDefault – set to False if you saved this image yourself. Otherwise, the default image saving procedure will be called.
Note: when saving images from image-lists (bullets, hotspots, list markers with images), TRichView creates a temporal TBitmap and passes it to this event.
See also events:
See also: