Re: TRichView in DLL

Return to index



Sergey Tkachenko

Posted: 03/04/2004 10:49:12

1) Create TRichView instead of TCustomRichView (it's not so important, but

TCustomRichView was not designed for creating as it is)

2) RichView requires Style property assigned to TRVStyle component. So you

need to create TRVStyle component as well, and assign it to RichView.Style

3) For some operations, including formatting and saving RTF file,

RichView.Parent must be assigned. If you will get an error message like

"controls needs a parent window", create a TForm at run time and assign it

to RichView.Parent (this form will be invisible as well as RichView)

3) Some property settings are required for best reading of RTF files. They

are shown in TRichView component editor when you right click the component

at designtime and choose "Settings" in the context menu, then select "Allow

adding styles dynamically". When creating TRichView at designtime, "Allow

adding styles dynamically" is set by default automatically. But for runtime

creation, you need to do it yourself.


> How do I create the control in a DLL?  What I actually want to use is

> the conversion functions only, I don't need any visaul portion, all

> that is done in a different part of my program.


> Is there any example of creating a TRichView dynamically.


> I have tried


>    RichView:=TCustomRichView.Create(nil);  // <-- we are in a dll

>    try

>         try

>            RichView.SaveOptions := [rvsoOverrideImages];

>            RichView.LoadRTF(rtfFile);

>            RichView.SaveHTML(htmlFile, 'Title', 'Img', saveoptions ) ;

>            result:=true;

>         except

>            result:=false;

>         end;

>      finally


>      end;

>    end;


> But it fails on LoadRTF, says index is out of range


> Thanks in advance


> Henry

Powered by ABC Amber Outlook Express Converter