Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Oct 19, 2016 1:07 pm

Hello,

We currently use your software to perform our mail merges which works well until a blank field is merged, instead of supressing the blank field a line break is left in place:

The address below:

Address 1 = "1"
Address 2 = ""
PostCode = "PostCode"

merges as:

1

PostCode

instead of

1
PostCode.

I have tried the following methods to suppress the blanks but it does not appear to work:

{ MERGEFIELD Address1 }
{ IF { MERGEFIELD Address2 } = "" "" "{MERGEFIELD ADDRESS2}
" }

{MERGEFIELD Data \f "¶
"
{MERGEFIELD Add_3 \b ¶}

Please can you advise how the suppression should be performed?

Thanks,
Danny

daniel.butler@legendware.co.uk
 
Posts: 1
Joined: Wed Oct 19, 2016 12:56 pm

Thu Oct 20, 2016 7:49 am

Dear Danny,

Thanks for your inquiry. There you were using an empty string, which is equivalent to have a placeholder. Our product only provides the method document.MailMerge.HideEmptyParagraphs = true to hide the empty paragraph that doesn't include any things. Sorry for inconvenience and you can use the follwing codes to get your effect at present.
Code: Select all
            string[] filedNames = new string[] { "Address1", "PostCode" };
            string[] filedValues = new string[] { "1", "PostCode" };
            document.MailMerge.HideEmptyParagraphs = true;
            document.MailMerge.Execute(filedNames, filedValues);

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.Doc