Hello,
I'm trying to perform a mail merge on a Word document with an IF statement, where one of the possible results has a hyperlink. For example:
{ IF { MERGEFIELD FieldName } = "True" "No need to log in" "Click { HYPERLINK "https://example.com/Account/Login" } to log in" }
The C# code I'm using is:
public void PerformMailMerge(WordDocument document, string[] names, string[] values)
{
document.MailMerge.RemoveEmptyParagraphs = true;
document.MailMerge.Execute(names, values);
document.UpdateDocumentFields();
}
The result of this if FieldName != "True" is:
Click here to log in"
That is, the text has a spurious double-quotes at the end of the line.
I've been able to get round this by putting "Click { HYPERLINK "https://example.com/Account/Login" } to log in" in a separate file and using:
{ IF { MERGEFIELD FieldName } = "True" "No need to log in" "{ INCLUDETEXT "TextWithLink.docx" }"
However, this adds 2 empty paragraphs under the text generated by the merge.
Would you be able to help me either get rid of the trailing double quotes in the first case, or the empty paragraphs in the second case?
Kind regards,
Barney Walton
UPDATE: I've updated Syncfusion.DocIO.AspNet.Mvc5 to version 21,2,4 (I was using v18.3.0.35 before) and now the output if I use the second method I describe above is:
Click here
i.e. the text after the link is missing.
With the first method I describe above, the result is the same.
Kind regards,
Barney