trichview.com

trichview.support




Re: Trichview and HTML mail


Return to index


Author

Message

Yernar

Posted: 03/27/2003 6:20:50


Recently I had the similar task, and Sergey helped me solve the problem.



The code below can be assigned to OnHTMLSaveImage event. It adds 'cid:' in HTML image links.

It assumes:

  1.. document has no image-list bullets, hotspots and list markers linked to image-list; if they present, you need to draw them in a temporal bitmap and then save just like gr in this example;

  2.. the latest version of RichView (with table and cell background images) is used

  3.. default image saving (as jpegs)


uses RVItem, RVTable, CRVData, RVMarker;

procedure TForm3.RichViewEdit1HTMLSaveImage(Sender: TCustomRichView;

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

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

var gr: TGraphic;

  Tag: Integer;

  VAlign: TRVVAlign;

  Name: String;

begin

  gr := nil;

  if ItemNo<0 then begin

    if RVData is TRVTableCellData then

      gr := TRVTableCellData(RVData).BackgroundImage

    else

      gr := Sender.BackgroundBitmap;

    end

  else

    case RVData.GetItemStyle(ItemNo) of

      rvsPicture, rvsHotPicture:

        gr := TRVGraphicItemInfo(RVData.GetItem(ItemNo)).Image;

      rvsListMarker:

        gr := TRVMarkerItemInfo(RVData.GetItem(ItemNo)).GetLevelInfo(Sender.Style).Picture.Graphic;

      rvsTable:

        gr := TRVTableItemInfo(RVData.GetItem(ItemNo)).BackgroundImage;

    end;

  if gr<>nil then begin

    Location := 'cid:'+RVData.SavePicture(rvsfHTML, 'img', Path, Sender.ImgSaveNo, True, BackgroundColor, gr);

    DoDefault := False;

  end;

end;






Powered by ABC Amber Outlook Express Converter