trichview.com

trichview.support




Re: Image issues with TRichViewEdit and saving as HTML


Return to index


Author

Message

Steven Brenner

Posted: 11/18/2003 11:35:45


Thank you so much for your help on this!

This looks like it will do exactly what I need!

I bet others have run into similar problems, might not be a bad idea for

a property.


Best Regard

Steven L. Brenner



"Sergey Tkachenko" <[email protected]> wrote:

>Add this code to event OnHTMLSaveImage.

>(this code assumes that prefix for image file names is 'img', and

>rvsoOverrideImages is specified in Options for saving. If not, change the

>first and the last parameters in call of RVData.GetNextFileName

>

>

>procedure TForm3.RichViewEdit1HTMLSaveImage(Sender: TCustomRichView;

>  RVData: TCustomRVData; ItemNo: Integer; const Path: String;

>  BackgroundColor: TColor; var Location: String; var DoDefault: Boolean);

>var gr: TGraphic;

>    bmp: TBitmap;

>    jpg: TJpegImage;

>    s: String;

>    AVAlign: TRVVAlign;

>    ATag: Integer;

>    Width, Height: Integer;

>begin

>  if (ItemNo>=0) and

>     ((RVData.GetItemStyle(ItemNo)=rvsPicture) or

>      (RVData.GetItemStyle(ItemNo)=rvsHotPicture)) then begin

>    RVData.GetPictureInfo(ItemNo, s, gr, AVAlign, ATag);

>    RVData.GetItemExtraIntProperty(ItemNo, rvepImageWidth, Width);

>    RVData.GetItemExtraIntProperty(ItemNo, rvepImageHeight, Height);

>    if Width=0 then

>      Width := gr.Width;

>    if Height=0 then

>      Height := gr.Height;

>    bmp := TBitmap.Create;

>    jpg := TJpegImage.Create;

>    try

>      bmp.PixelFormat := pf32bit;

>      bmp.Width := Width;

>      bmp.Height := Height;

>      bmp.Canvas.StretchDraw(Rect(0,0,Width,Height), gr);

>      jpg.Assign(bmp);

>      Location := RVData.GetNextFileName('img', Path, '.jpg',

>Sender.imgSaveNo, True);

>      jpg.SaveToFile(Location);

>      Location := ExtractRelativePath(Path, Location);

>      DoDefault := False;

>    finally

>      bmp.Free;

>      jpg.Free;

>    end;

>  end;

>end;

>

>





Powered by ABC Amber Outlook Express Converter