We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

MergeField field codes seemingly can not contain two formatting codes

Thread ID:

Created:

Updated:

Platform:

Replies:

142019 Jan 15,2019 10:07 AM UTC Jan 17,2019 03:40 PM UTC ASP.NET Web Forms 4
loading
Tags: DocIO
Alexander Khounani
Asked On January 15, 2019 10:07 AM UTC

We have created a merge field event handler like the following:

 Private Sub ApplyListFormatOptionsEvent(sender As Object, args As MergeFieldEventArgs)
            'Bullet / unordered list options
            If args.CurrentMergeField.FieldCode.Contains(FIELD_FORMATTING_CODE_BULLETS_SQUARE) Then
                args.Text = args.Text.Replace("<ul>", "<ul style=""list-style-type: square"">")
            End If
            If args.CurrentMergeField.FieldCode.Contains(FIELD_FORMATTING_CODE_BULLETS_CIRCLE) Then
                args.Text = args.Text.Replace("<ul>", "<ul style=""list-style-type: circle"">")
            End If
            If args.CurrentMergeField.FieldCode.Contains(FIELD_FORMATTING_CODE_BULLETS_NONE) Then
                args.Text = args.Text.Replace("<ul>", "<ul style=""list-style-type: none"">")
            End If

            'Numbered / ordered list options
            If args.CurrentMergeField.FieldCode.Contains(FIELD_FORMATTING_CODE_NUMBERLIST_ROMAN_UPPER) Then
                args.Text = args.Text.Replace("<ol>", "<ol type=""I"">")
            End If
            If args.CurrentMergeField.FieldCode.Contains(FIELD_FORMATTING_CODE_NUMBERLIST_ROMAN_LOWER) Then
                args.Text = args.Text.Replace("<ol>", "<ol type=""i"">")
            End If
            If args.CurrentMergeField.FieldCode.Contains(FIELD_FORMATTING_CODE_NUMBERLIST_LETTERED_UPPER) Then
                args.Text = args.Text.Replace("<ol>", "<ol type=""A"">")
            End If
            If args.CurrentMergeField.FieldCode.Contains(FIELD_FORMATTING_CODE_NUMBERLIST_LETTERED_LOWER) Then
                args.Text = args.Text.Replace("<ol>", "<ol type=""a"">")
            End If
        End Sub

.. and added it like this: AddHandler document.MailMerge.MergeField, AddressOf ApplyListFormatOptionsEvent

It works great, unless we try having a merge field that would have two field formatting codes in the end, like {MERGEFIELD  ProjectDescription \circlebullets \romanupper}. Those merge fields seem to not be recognised by the MailMerge at all, or at least they will not call any event nor will there be a printed record.
Is there some notation we are using wrongly, or is that an actual bug?

Vijay Ramachandran [Syncfusion]
Replied On January 16, 2019 09:33 AM UTC

Hi Alexander,

Thank you for contacting Syncfusion support.

Yes, you can use multiple merge field formatting codes, but you have to add “\*” as a prefix of the formatting token. Please find the modified field code from below and let us know if it helps.
 
Old Field Code 
New Field Code 
MERGEFIELD  ProjectDescription \circlebullets \romanupper 
MERGEFIELD  ProjectDescription \* circlebullets \* romanupper 

You can find the template document from below and let us know if it helps.
http://www.syncfusion.com/downloads/support/forum/142019/ze/Template43117338

Regards,
Vijay R
 


Alexander Khounani
Replied On January 16, 2019 10:23 AM UTC

Hello Vijay,

sadly, this does not work with the provided template. (I tested it with keeping the constants as "\circlebullets", checking for that format, as well as with changing them to and checing for "circlebullets" and so on).  Again no value is exported (and the mergefield event is never reached in code) with two of them, but with one of them it works fine.

Alexander Khounani
Replied On January 16, 2019 10:29 AM UTC

I got it to work by changing the field from your provided template from {MERGEFIELD ProjectDescription \* circlebullets  \* romanupper \* MERGEFORMAT} to {MERGEFIELD ProjectDescription \* circlebullets  romanupper \* MERGEFORMAT}, removing the second \*.

Dilli Babu Nandha Gopal [Syncfusion]
Replied On January 17, 2019 03:40 PM UTC

Hi Alexander, 

We are glad to know that the reported issue has been resolved at your end. Please let us know if you need any further assistance on this. 

Regards, 
Dilli babu. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;