Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RichEdit & JvRichEdit display table formatting wrong

439 views
Skip to first unread message

AntonE

unread,
Mar 13, 2008, 5:32:45 PM3/13/08
to
I'm creating RTF files from MSWord with tables that need auto-size
(multi-line) cells. MSWord & Wordpad displays them correctly, but in
TRichEdit & TJvRichEdit, the cells remain oneline and the text flows over to
the cell to the right instead of sizing to multi-line.

Is there a setting I need to change to correct this?

Any help appreciated
Ekkas


Peter Below (TeamB)

unread,
Mar 14, 2008, 3:03:09 PM3/14/08
to
AntonE wrote:

Wordpad always uses the latest rich edit version available on the
Windows version it comes with. TRichedit still uses version 1.0,
TJvRichedit probably uses version 2 or 3. For the feature you want
version 4 is needed if memory serves.

--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com

AntonE

unread,
Mar 31, 2008, 6:36:37 AM3/31/08
to
Is there a way to force TRichEdit or TJvRichEdit to use the ver 4, or is
that not compatible? Or any other RichEdit component for Delphi that is not
dependent on DotNet.
Thanks for the response.
AntonE

"Peter Below (TeamB)" <no...@nomail.please> wrote in message
news:xn0fnonn...@newsgroups.borland.com...

Peter Below (TeamB)

unread,
Mar 31, 2008, 2:23:48 PM3/31/08
to
AntonE wrote:

> Is there a way to force TRichEdit or TJvRichEdit to use the ver 4, or
> is that not compatible? Or any other RichEdit component for Delphi
> that is not dependent on DotNet.

You will get version 3 with TJvRichEdit automatically, if memory
serves, but version 4 is in a different DLL (Msftedit.dll) and I don't
know how compatible its interface is with version 3. The main problem
with V4 is that it is not available on platforms < XP SP1 and it is not
redistributable, as far as I know. Another problem is that V4 uses the
same window class name as V2 and V3, even though it is in a different
DLL. However, that may offer a way to magically make TJvRichedit use V
4, by explicitely loading msftedit.dll *after* the TJVRichEdit has
loaded riched20.dll but *before* it has created its window handle.

Add an Initialization section to your main forms unit. In it place a
call

Initialization
LoadMsftEditDLL;

Above the Initialization add

procedure LoadMsftEditDll;
var
hDLL: THandle;
begin
hDLL := SafeLoadLibrary('msftedit.dll');
if hDLL = 0 then
MessageBox(0, 'Rich edit version 4.1 not installed, using version 2
or 3', 'Fallback', MB_OK or MB_ICONINFORMATION);
end;

Build and run and test whether the TJVrichedit now correctly displays
your problem tables.

No warranties...

AntonE

unread,
Mar 31, 2008, 6:29:38 PM3/31/08
to
> DLL. However, that may offer a way to magically make TJvRichedit use V
> 4, by explicitely loading msftedit.dll *after* the TJVRichEdit has
> loaded riched20.dll but *before* it has created its window handle.

Although your patch didn't work, I'm seeing a glimmer of hope...
As you'll see below, shouldn't there be a
CreateSubClass(Params,'RICHEDIT50W') somewhere in your patch?

Now that I knew what to search for (msftedit.dll), uncle Google gave me this
page, messy, but working! I tried similar changes for TJvRichEdit,as
TRichEdit doesn't display images, with a few tweaks, I got it working. Now
just to let the JEDI guys know about this... I also included a version check
before loading the new DLL/CreateSubClass, so in Win98 the older DLL should
still load as msftedit.dll is apparently only included from XPsp1.

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_21356661.html

basically telling how to override the TRichEdit loading of the DLL:

For Delphi 2005 TRichEdit:

Copy ComCtrls to your project folder, so that your changes are local to the
project.

Add ComCtrls to your project, to be sure that your modified file is used
instead of Delphi stock ComCtrls.

Go to TCustomRichEdit.CreateParams and edit RichEditModuleName value as
"RichEditModuleName = 'MSFTEDIT.DLL';"

Edit the CreateSubclass call as "CreateSubClass(Params, 'RICHEDIT50W');"

Run the project and find out that an exception is raised in
TRichEditStrings.Insert. It is sort of saveguard check. Since the code looks
reasonable, most likely the version 1.0 check does not hold with version
4.1, so comment it out:

//if RichEdit.SelStart <> (Selection.cpMax + Length(Str)) then
// raise EOutOfResources.Create(sRichEditInsertError);

Now "richEdit.Lines.LoadFromFile(OpenDialog.FileName);" displays correctly
formatted table. I do not know if there are other incompatibilities between
Delphi version 1.0 code and used version 4.1.


Peter Below (TeamB)

unread,
Apr 1, 2008, 1:35:33 AM4/1/08
to
AntonE wrote:

> As you'll see below, shouldn't there be a
> CreateSubClass(Params,'RICHEDIT50W') somewhere in your patch?

That was the missing piece I could not find on short notice. The MSDN
page for richedits mentions the existence of V. 4 but gives the
impression that it uses the same classname as the V 2 and 3.

AntonE

unread,
Apr 2, 2008, 2:56:15 PM4/2/08
to
>> As you'll see below, shouldn't there be a
>> CreateSubClass(Params,'RICHEDIT50W') somewhere in your patch?
>
> That was the missing piece I could not find on short notice. The MSDN
> page for richedits mentions the existence of V. 4 but gives the
> impression that it uses the same classname as the V 2 and 3.


Thanks a lot
Your input set me on the right track.
AntonE


0 new messages