Hi,
I’ve created a mailmerge field with some text prefix.
e.g. Date: «Date»
When I try to replace the merge field with some data from the database, the text prefix is gone.
e.g.
Hi Kiran,
The text outside of mail merge field should be preserved, only the field should be replaced. Please double check that your prefix stays outside of the merge field and attach your document to your post here to review.
Hi,
yes, the prefix does stay outside of the merge field and I’ve attached a simple template file with a few merge fields in. Please check it and let me know what I’m doing wrong.
Thanks,
Kiran.
No, the prefixes are within merge fields in your document, furthermore, merge fields contain text that duplicates their names. I’ve corrected the document and now it’s ready to work, see attached
ok, now the prefixed text and the merge field have no relation. I’d like the prefixed text to be displayed only when there is a value for the merge field. otherwise, I’d like the prefixed text to be gone when I delete the mergefields. is there a way to do this ?
Thanks,
Kiran.
Well if your document structure is similar to that of the sample document you attached, you can run something like this at the end of processing in order to clean up remaining merge fields and their owner paragraphs:
NodeList fields = doc.SelectNodes("//FieldStart");
foreach (FieldStart fieldStart in fields)
{
if (fieldStrt.FieldType == FieldType.FieldMergeField)
fieldStart.ParentNode.Remove();
}
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.