Hello,
I'm trying to insert html fragments in a mail merge. The HTML has two H1 sections at beginning.
eg
Contents.MergePar.LoadFromString('<h1>This is header 1</h1><h1>This is header 2</h1>', 'HTML');
There is no break after the first h1 tag and the text attributes don't have a h1 appearence. If I load the html as a file then it's OK.
Is there something I need to set before doing the mail merge?
Cheers,
Paul
#1
♥ 0
5.1k Views
2 users
read 2 min
Hello,
I created a very simple Delphi app with single RTFEditor and a button. In the OnClick event for the button is ;
Editor.ActiveText := Editor.BodyText;
Editor.ActivePar.LoadFromString('<h1>Hello World</h1><h1>Hello Mars</h1><h1>Hello Universe</h1>', 'HTML');
Editor.Refresh();
Only the third h1 tag is displayed correctly. The first two are on the same line and are of normal text.
Cheers,
Paul
#2
♥ 0
Hi,
I created a test file:
<html><h1>Hello World</h1><h1>Hello Mars</h1><h1>Hello Universe</h1></html>
That was loaded ok. Do you use the latest version, or at least 5.21?
Julian
#3
♥ 0
Hello Julian,
I am using 5.210.
The problem is possibly with the LoadFromString method. In my initial post I did say that loading from a file rendered correctly.
Cheers,
Paul
#4
♥ 0
Hi,
I now see it:
Editor.ActivePar.LoadFromString('<h1>Hello World</h1><h1>Hello Mars</h1><h1>Hello Universe</h1>', 'HTML');
You try to load the text into one paragraph. I assume you want to use the 'AsChildren' falg in the modes for this method.
Julian
#5
♥ 0
Hello Julian,
That did it!!!
Cheers,
Paul
#6
♥ 0
This category is archived. No new posts are possible.