trichview.com Forum Index trichview.com
TRichView support forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[How to] How to save OLE objects in RTF

 
Post new topic   Reply to topic    trichview.com Forum Index -> Examples, Demos
View previous topic :: View next topic  
Author Message
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 6576

PostPosted: Thu Sep 15, 2005 4:59 pm    Post subject: [How to] How to save OLE objects in RTF Reply with quote

Saving TOLEContainers from TRichView to RTF file:
http://www.trichview.com/forums/viewtopic.php?t=108
Back to top
View user's profile Send private message Visit poster's website
Sergey Tkachenko
Site Admin


Joined: 27 Aug 2005
Posts: 6576

PostPosted: Tue Sep 29, 2009 9:16 am    Post subject: Reply with quote

I created a unit based on the code from the topic above.
http://www.trichview.com/support/files/saveolecontainertortf.zip

It contains the function
Code:
function GetOleContainerRTFString(OleContainer: TOleContainer;
  Image: TMetafile = nil): String;

This function returns RTF representation of OleContainer for assigning to OutStr parameter of TRichView.OnSaveComponentToFile event:
Code:
procedure TForm1.RichViewEdit1SaveComponentToFile(Sender: TCustomRichView;
  Path: String; SaveMe: TPersistent; SaveFormat: TRVSaveFormat;
  var OutStr: String);
begin
  case SaveFormat of
   ...
   rvsfRTF:
      begin
        if SaveMe is TOleContainer then
          OutStr := GetOleContainerRTFString(TOleContainer(SaveMe))
        ...
      end;
  end;
end;

The second parameter (Image) is optional. If assigned, this metafile will be used as an image representing this OleContainer. If not assigned, the function makes this image itself.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    trichview.com Forum Index -> Examples, Demos All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group