ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder
ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 RichEdit import/export

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Format  BoldItalicizedUnderline Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailBrowse for an image to attach to your post Browse for a zip to attach to your post Insert CodeInsert QuoteInsert List


Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

Check here to subscribe to this topic.

T O P I C    R E V I E W
jrpcguru Posted - Nov 14 2019 : 18:36:41
I am trying to use the demo: ImageEn\Demos\Other\RichEdit using D10.3 and ImageEn 8.7.5.
Nothing happens when I try to import from a .Doc or .Docx file. Nothing happens when I try to export to .Docx or .PDF. I think I have updated the in the Delphi10.3Rio folder.

What am I missing to make this work? The help file says: "Import and export to PDF and Microsoft Word, if available (ImportFromWord/ExportToWord and CanImportExport methods)"

What will make it available?

13   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 02 2020 : 18:54:57

I'll need to look into that. In the meantime, please use:

Editor.SelStart := Length( Editor.Text );
Editor.SelText  := 'new line text' + #13#10

Xequte Software
jrpcguru Posted - Feb 02 2020 : 11:01:30
If you do end up fully supporting TIERichEdit, I have found an odd bug.

Editor.Lines.Add('new line text');

This line compiles, but it generates "RichEdit line insertion error" at runtime.
It doesn't matter whether Editor.PlainText = true or false.
TRichEdit compiles and runs this code without difficulty.

jrpcguru Posted - Jan 30 2020 : 18:41:40
I did post my corrected demo as you requested.

Goofing the test for CanImportExport was a bit careless of me! Must have been tired. Unfortunately after I fixed it, it still didn't work with Word 2007. So I will deal with that later when another project needs that feature.


xequte Posted - Jan 30 2020 : 16:16:48

Sorry if my response seemed a little abrupt. As you surmised, TIERichEdit was added as an internal component to add rich text support to TIETextLayer, but it seemed a waste not to make it generally available.

In order to keep EXE size small for our developers (something we think a lot about), we disable (via defines) any features that weren't needed. We also did not test them.

My hope is that the component is used enough that there is demand to add and test more functionality, but time will tell.

I liked your demo changes. I've added the error traps when importing and exporting to our main demo, though you need to change it to:

if Editor.CanImportExport() = False then...

I cannot add the Find/Replace ones at this time because they require the undefined functionality.

If you complete it, you might want to add it to:

Xequte Software
jrpcguru Posted - Jan 30 2020 : 11:43:26
I must say that I was taken aback by your reply. But then I realized you probably introduced TIERichEdit to gain improvements in text layers. But I like its other benefits so I have been working with it.

I did not succeed in using the internal Find/Replace. But those are based on TFindDialog and TReplaceDialog so I just used those dialogs. I have attached your demo program with my results, in hopes that someone else will benefit from a decent starting point. If you like my additions, please feel free to make it your future demo.

In the demo I added a menu bar with a set of options for Find, Next, Previous, and Replace. I've never seen code for searching backwards in a TRichEdit, but TIERichEdit supports this both with the backwards search option in TFindDialog and with the code I've provided in the Previous menu option.

I felt it was worth using TIERichEdit because I liked the URL launching, backwards searching, popup toolbar and image pasting. There are other possible areas to benefit but my current project doesn't require them - yet. That includes the ability to import DOCX and PDF files. I did add error traps for those features using the CanImportExport function.

I hope you continue to support TIERichEdit and document it more fully in future versions.

2926.95 KB

xequte Posted - Jan 18 2020 : 03:11:58

I'm afraid that Find support in TIERichEdit is an unsupported feature. It has not been tested and I personally have not tried it and don't know how it works. If enough users ask about it, then we will enable the feature and fully test and document it.

Xequte Software
jrpcguru Posted - Jan 17 2020 : 19:59:05
I used your suggestion of putting "xyz" into Interestingly it failed to compile when was in either folder:
yet changing the configurations made no difference.

But when I used C:\ProgramData\ImageEn\Source\ and updated my library path, I was finally able to get the configuration changes to give me your Find dialog and was able to paste images into the TIeRichEdit. So far so good and very nice.

Using your demo program I have tried to implement the find dialog by attaching the following code to a button:

      With Editor do

          if SelLength > 0 then

This pops up the find dialog but does not hi-lite the found text or scroll when needed until I close the find dialog. As best as I can tell from the source code, you are trying to hi-lite the found text, but maybe not setting focus so it is visible? Or I don't know how to access the found location?

I made a Next button with this code:

With Editor do
    if CanFindNext then
        SetFocus; //without this, text is not hi-lited
      showmessage('can not find anymore');

This does hi-lite the found text and scroll the window as needed. I can reopen the Find dialog and tell it to search backwards and that works, as do the other optional buttons. But the CanFindNext never reports false even at the end of the text.

I assume the FindText() is present to allow me to use my own TFindDialog which I may be forced to do even though you provide one.

Even though the find features are now compiling, I do not have any idea how to use these properties:

I hope I'm not the only one who doesn't understand how to use this nicely improved rich text object without better documentation.

xequte Posted - Jan 12 2020 : 21:17:22

I have updated the code so that the dialogs are centered when the toolbar is near the bottom.

If CanImportExport is False then the app cannot create the OLE Object "Word.Application". You should research that on an Office developers site.

If you define "RichEditFindAndReplace" then the following members are available:

    property CanFindNext: Boolean;
    function FindNext(): Boolean;
    function FindDialog(const SearchStr: string): TFindDialog;
    function FindText(const SearchStr: string; StartPos, Length: Integer; Options: TIESearchTypes): Integer;
    function ReplaceDialog(const SearchStr, ReplaceStr: string): TReplaceDialog;
    property OnTextNotFound: TIEFindErrorEvent;
    property OnCloseFindDialog: TIEFindCloseEvent;

Review the iexRichEdit source for more detail.

Add some error text, e.g. "xyz" to and see if Delphi errors out to ensure that is being read.

Xequte Software
jrpcguru Posted - Jan 10 2020 : 23:12:45
Further question.
In the demo program you can programmatically change the auto toolbar like this:

Editor.AutoToolbar.Position := iepBelow;
Editor.AutoToolbar.Position := iepAbove;

But when I tried doing this, I noticed the font dialog and color dialog do not work properly when the toolbar is at the bottom. They drop down and disappear if the program is maximized, rather than bouncing up like a drop down should. Oddly, the text alignment drop down does bounce up correctly.

jrpcguru Posted - Jan 09 2020 : 17:30:00
I've added the following folders to the library path:

Both copies of now look like this:
// Allow Rich Text (RTF) formatted text layers in TImageEnView
{$define IESupportRichText}

// Support for insertion of images and other objects in TIERichEdit (48KB)
{$define RichEditObjectSupport}

// Support for Find and Replace dialogs in TIERichEdit (8KB)
{$define RichEditFindAndReplace}

// Support for popup toolbar for TIERichEdit and TIETextLayer (trims about 5KB)
{$define RichEditPopUpToolbar}

Apparently my IE.INC is correct because I do get the popup toolbar.

I haven't tried recompiling ImageEn since your instructions say having the modified IE.INC in the proper library path will work. I hope that is true since I doubt I will want to recompile ImageEn after every new version is installed.

After compiling the demo, I copy it to my other system that has Word 2007 and the Editor.CanImportExport reports that importing won't work.

Related question:
The Help file says this:
Enhanced Find and Replace (Requires RichEditFindAndReplace to be defined in

What is enhanced? Do I still use TFindDialog? I briefly hoped you had provided a hotkey for Find & Replace, but I don't find that. I also don't find a replacement for TFindDialog, so I'm stymied. I would love to have an enhanced Find that allowed both down and up searching. And even better would be one that allowed me to adjust the font size since all standard dialogs are way too tiny these days.

xequte Posted - Nov 15 2019 : 13:44:58

Office 2003 did not support docx or PDF. You need at least Office 2007.

We don't enable some of the advanced features because TIETextLayer does not take advantage of them and they make it significantly larger. Please open and search for rich edit to find the relevant one.

You'll then either need to recompile the ImageEn packages, or add the ImageEn source folder to your library path.

Xequte Software
jrpcguru Posted - Nov 15 2019 : 13:23:00
I have Office 2003 installed. What version is required?
Also, the help file says that images can be embedded into the text. I find no sample,no method, no hint of how to do that either. With other editors like Word and email, I just paste an image in. No luck there. I tried an image from the Windows Snipping Tool and one from ImageEn. Your stated features are very tantalizing but currently frustrating.

xequte Posted - Nov 15 2019 : 04:26:37

You need to have Microsoft Word installed to use the feature.

Xequte Software