ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder
ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 RichEdit import/export
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jrpcguru

USA
125 Posts

Posted - Nov 14 2019 :  18:36:41  Show Profile  Reply
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 ie.inc 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?

J.R.

xequte

4977 Posts

Posted - Nov 15 2019 :  04:26:37  Show Profile  Reply
Hi JR

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

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
125 Posts

Posted - Nov 15 2019 :  13:23:00  Show Profile  Reply
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.

J.R.
Go to Top of Page

xequte

4977 Posts

Posted - Nov 15 2019 :  13:44:58  Show Profile  Reply
Hi JR

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 ie.inc 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.




Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
125 Posts

Posted - Jan 09 2020 :  17:30:00  Show Profile  Reply
I've added the following folders to the library path:
C:\ProgramData\ImageEn\Delphi10.3Rio\ie.inc
C:\ProgramData\ImageEn\Source\Delphi10.3Rio\ie.inc

Both copies of ie.inc 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 ie.inc)

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.


J.R.
Go to Top of Page

jrpcguru

USA
125 Posts

Posted - Jan 10 2020 :  23:12:45  Show Profile  Reply
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.



J.R.
Go to Top of Page

xequte

4977 Posts

Posted - Jan 12 2020 :  21:17:22  Show Profile  Reply
Hi JR

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 ie.inc and see if Delphi errors out to ensure that ie.inc is being read.



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
125 Posts

Posted - Jan 17 2020 :  19:59:05  Show Profile  Reply
I used your suggestion of putting "xyz" into ie.inc. Interestingly it failed to compile when ie.inc was in either folder:
C:\ProgramData\ImageEn\Delphi10.3Rio\ie.inc
C:\ProgramData\ImageEn\Source\Delphi10.3Rio\ie.inc
yet changing the configurations made no difference.

But when I used C:\ProgramData\ImageEn\Source\ie.inc 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
        begin
          editor.SetFocus;

          if SelLength > 0 then
            FindDialog(SelText)
          else
            FindDialog('');
        end;

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
  begin
    if CanFindNext then
      begin
        FindNext;
        SetFocus; //without this, text is not hi-lited
      end
    else
      showmessage('can not find anymore');
  end;


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:
OnTextNotFound
OnCloseFindDialog

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

J.R.
Go to Top of Page

xequte

4977 Posts

Posted - Jan 18 2020 :  03:11:58  Show Profile  Reply
Hi JR

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.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
125 Posts

Posted - Jan 30 2020 :  11:43:26  Show Profile  Reply
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.

attach/jrpcguru/2020130113551_RichEdit.zip
2926.95 KB

J.R.
Go to Top of Page

xequte

4977 Posts

Posted - Jan 30 2020 :  16:16:48  Show Profile  Reply
Hi JR

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:

https://www.imageen.com/ieforum/topic.asp?TOPIC_ID=1446


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
125 Posts

Posted - Jan 30 2020 :  18:41:40  Show Profile  Reply
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.

Thanks.

J.R.
Go to Top of Page

jrpcguru

USA
125 Posts

Posted - Feb 02 2020 :  11:01:30  Show Profile  Reply
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.


J.R.
Go to Top of Page

xequte

4977 Posts

Posted - Feb 02 2020 :  18:54:57  Show Profile  Reply
Hi JR

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

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



Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To: