Hi,
Thanks for your answer.
I just tried to use InputEditField but it doesn't seem to work better (it is even worse) : after a merge the end tag isn't recognized anymore and is considered as a normal character.
Perhaps there is something I do wrong.
Hi,
Thanks for your answer.
I just tried to use InputEditField but it doesn't seem to work better (it is even worse) : after a merge the end tag isn't recognized anymore and is considered as a normal character.
Perhaps there is something I do wrong.
Hello,
As I posted it here yesterday, I have the same kind of problem. After more investigations, it seems that the file does not save correctly (using saveToFile()).
When I open my RTF file with notepad, at the end of the file instead of having what I guess should be :
{\field{\*\fldinst{MERGEFIELD Field0 }}<\plain\f0\fs22\cf0 Text0}\plain\f0\fs22\cf0 {\field{\*\fldinst{MERGEFIELD Field1 }}<\plain\f0\fs22\cf0 Text1}}}
I have :
The beginning is similar but there is a missing part at the end.
I've checked all properties of the TWPRichText component but none seems to impact on the problem.
Any help would really be appreciated.
Jeffres
PS : Here is a copy of my message on newswhat forum, sorry for the length of my post.
I am facing a problem with WPTools 4.x (not sure about the exact version,
could anyone tell me how to get it ?) in C++ Builder 5. I've found no
other mention of this kind of issue over the Internet, so I hope someone
could help me here.
What I do is quite simple.
I have a form with a TWPRichText and 3 buttons : "Insert", "Merge" and "Load".
The "Insert" button adds a mail-merge field with the text "Texti" and the
field name "Fieldi" (in which i is a number incremented each time one
click the button).
The "Merge" button first saves the TWPRichText content in a file and then
merges the text.
The "Load" button simply loads again the file.
---------------------------------------------------------
Here are two examples, the first that works right, and the second that
demonstrates the problem :
1) I click on "Insert" 3 times, pressing the enter key between each click
to go on a new line, as to obtain the following text :
2) Then I click the "Merge" button, what results in :
3) Then I click the "Load" button which gives me again :
And so on, that works. But let's see the other case :
1) I use the "Insert" button and the Enter key to obtain the following text :
2) Then here is what I obtain when merging, what seems correct :
3) But then when I reload the file, I again have the text as in 1), except
that the '<' character before "Field1" isn't red (as all insert points
generally are) but black.
And if i merge again, I get :
"<Field1" has disappeared !!!
And that happens as soon as 2 mail-merge fields are put side by side, what
means that if I had put a space or any other character between "<Text0"
and "<Text1", then everything would have gone all right.
Has anyone met this problem or have a solution ? Is it a bug from WPTools ?
Thanks for your answers.
Jeffres
---------------------------------------------------------
Here is the code executed when I click the "Insert" button :
static int i; WPRichText1->InputField( '<', PERString( "Text" ) + IntToStr( i ), PERString( "Field" ) + IntToStr( i ) ); i++;
Here is the code executed when I click the "Merge" button :
WPRichText1->InsertPointAttr->Hidden = false; WPRichText1->SaveToFile( "test_edition.rtf" ); WPRichText1->MergeText();
Here is the code executed when I click the "Load" button :
And here is the MailMergeGetText function of my TWPRichText :