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.

Thu Jul 11, 2019 6:21 am

hi,
i read a lot of spire documentation and code in forum,
and i didn't find how to remove empty line when i use merge and merge group.

i have to clean only the empty line generated with those functions because in my result document i have to keep other design empty line.

i use this spire function's :
document.MailMerge.ExecuteGroup
and
document.MailMerge.Execute

with word : when the data for fieldmerge is null or empty or only space and the line result is empty null or space -> the line is removed.

can you give one solution for each spire function merge and merge group to remove empty line or lign contains only space.



merge with word and merge with spire.doc :
in this example you see word and spire traitement -> two empty lines after the text merge with spire -> these ones are 2 empty fieldmerge

mergeemptyline.png


thank's you foir your help
FH

labaffagaston
 
Posts: 42
Joined: Sun Dec 24, 2017 7:38 pm

Thu Jul 11, 2019 7:53 am

Hello,

Thanks for your inquiry.
To help us provide an accurate resolution for you, please share us with your original Word file as well as your full testing code. Thanks in advance.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Mon Jul 22, 2019 4:01 am

Hello,

Greetings from E-iceblue.
Could you please let us know how is the issue going? Thanks in advance for your feedback and time.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Mon Jul 22, 2019 5:56 am

hello
i can't share orginal document.
i have to create on vstd solution for send tou an example.
but I do not have time , sorry
m y problem is when i use MailMerge.Execute for Group with (Groupstart groupend) or (TableStart TableENd)

groupe.png


i need to delete the entire line when the data signet is string empty and line result is empty in group or tablegroup .

and only delete the line result empty in the group after merge traitement
because before and after group there are validated line empty in document .

Thank's for your help
FH

labaffagaston
 
Posts: 42
Joined: Sun Dec 24, 2017 7:38 pm

Mon Jul 22, 2019 7:24 am

Hello,

Thanks for your more information.
When doing MailMerge, there are two properties (HideEmptyParagraphs and HideEmptyGroup) to remove the empty fields, please refer to the following code snippet to test your case. If there is still any question, just feel free to write back.
Code: Select all
......
 //remove empty paragraphs
 document.MailMerge.HideEmptyParagraphs = true;
 //remove empty group
 document.MailMerge.HideEmptyGroup = true;
 document.MailMerge.Execute(string[] filedNames, string[] filedValues);
....

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Jul 30, 2019 2:56 am

Hello,

Greetings from E-iceblue.
Did the code work for you? Thanks in advance for your feedback and time.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Doc