I am trying to insert HTML that has an image embedded in it, the image is about 86 K
HTML looks something like:
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmwAAAHvCAYAAADpWYPOAAAAAXNSR0I..........mCC"></p>
And I get this error:
System.NotSupportedException
HResult=0x80131515
Message=DocIO support only welformatted xhtml
Details:
The 'img' start tag on line 1 position 95 does not match the end tag of 'p'. Line 1, position 86886.
This is the C# code I use:
public static void MergeFieldEvent(object sender, MergeFieldEventArgs args)
{
if (args.FieldName.Equals("Appendix"))
{
WParagraph paragraph = args.CurrentMergeField.OwnerParagraph;
int paraIndex = paragraph.OwnerTextBody.ChildEntities.IndexOf(paragraph);
int paraItemIndex = paragraph.ChildEntities.IndexOf(args.CurrentMergeField);
string html_string = args.FieldValue.ToString();
html_string = html_string.Replace("<br>", "<br />");
paragraph.OwnerTextBody.InsertXHTML(html_string, paraIndex, paraItemIndex);
args.Text = string.Empty;
}
}
Can you please help solving this problem?