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!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
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 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.
17   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Apr 19 2020 : 01:19:53
Thanks for the report, JR,

There will be a fix for AddLine in the next release.



Nigel
Xequte Software
www.imageen.com
jrpcguru Posted - Apr 18 2020 : 16:04:03
Thank you for the prompt reply.
I tried Editor.AddLine and it does work. But it seems to only add the line at the top of the text, not the bottom. Even using
Editor.SelStart := Length( Editor.Text ); //this does move to bottom
but AddLine still adds to top.

Your suggestion above to use:

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

This does work.

Editor.Lines.Append also compiles but gives an error message.
The following compiles and successfully adds the text at the bottom of the text.
try
Editor.Lines.Add('xxxxxxxxxxxxxxxx');

except
end;

Presumably if I put "Editor.Lines.Append" inside a try/except it would also work. Of course both would qualify as a nasty kludge!

Thanks again for improving your support of TIERichEdit.

Also, as far as the weird shortcut key for Shift+Ctrl+I I have confirmed this with your current 9.0.0 demo:
if Editor.KeyboardShortcuts = false and multiple lines are selected, this removes those lines entirely. If the cursor is at the beginning of a paragraph it indents the paragraph. If KeyboardShortcuts = true then Ctrl+I and Shift+Ctrl+I toggles italics for the selection.


J.R.
xequte Posted - Apr 15 2020 : 22:02:36
Hi

If Find are included in a later date (not undefined) we will add documentation for them.

The shortcuts you mention do not function when I test on my system.

Yes, sorry, the hover toolbar code in 8.7.* was not finalized (because we knew it was going to be expanded in 9.0.0) so we changed the interface to a better model.

The changes are:

TIERichEdit.AutoToolBar.Enabled >>> TIERichEdit.AutoToolBar
TIERichEdit.AutoToolBar.Position >>> IEGlobalSettings().RichEditorToolbar.Position
TIERichEdit.AutoToolBar.ExcludedButtons >>> IEGlobalSettings().RichEditorToolbar.Buttons (now not exclusions!)

https://www.imageen.com/help/TIEImageEnGlobalSettings.RichEditorToolbar.html

I don't see a good solution to Editor.Lines.Add(). Please use Editor.AddLine();

I'm afraid checking for changes to ie.inc during installation would be problematic (e.g. clashes between our changes and user changes).


Nigel
Xequte Software
www.imageen.com
jrpcguru Posted - Apr 15 2020 : 18:49:24
Thank you for the TIERichEdit improvements in ver 9.0.0. The documentation does seem nicely expanded though still missing anything about Find.

I stumbled on an oddity of this control which still exists in the new version. I wanted to use Ctrl+I to indent a paragraph similar to the Delphi editor. Of course Ctrl+I toggles italics, so I tried Shift+Ctrl+I and discovered it is a built in, undocumented, hot key. It indents the first line of a paragraph. Fortunately Ctrl+M and Shift+Ctrl+M were available for indenting and unindenting, imitating Word.

I have only begun testing the new features. I would note one item that I don't find documented in your change record.
Editor.AutoToolBar.Enabled seems to have been removed along with .ExcludedButtons and .Position.

Apparently you have not corrected the problem with Editor.Lines.Add('new line text').

I managed to forget the need to update in.inc to fully use the features of TIERichedit. I wonder if the installer could preserve prior versions of in.inc or warn of the need to update it?

J.R.
xequte Posted - Feb 02 2020 : 18:54:57
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
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.


J.R.
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.

Thanks.

J.R.
xequte Posted - Jan 30 2020 : 16:16:48
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
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.

attach/jrpcguru/2020130113551_RichEdit.zip
2926.95 KB

J.R.
xequte Posted - Jan 18 2020 : 03:11:58
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
jrpcguru Posted - Jan 17 2020 : 19:59:05
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.
xequte Posted - Jan 12 2020 : 21:17:22
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
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.



J.R.
jrpcguru Posted - Jan 09 2020 : 17:30:00
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.
xequte Posted - Nov 15 2019 : 13:44:58
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
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.

J.R.
xequte Posted - Nov 15 2019 : 04:26:37
Hi JR

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

Nigel
Xequte Software
www.imageen.com