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. Image for the cookie policy date
close icon

Remove Empty Paragraphs using PDF converter

Hi Support,

I have a print report feature using mail merge template in my application.
i'm using MailMerge.RemoveEmptyParagraphs method on print to word feature and it works perfectly.
My question is, how to use it if i want to print the document to pdf?
My code:

Dim document As New WordDocument
document = New WordDocument("..\x.doc")
document.MailMerge.RemoveEmptyParagraphs = True
document.MailMerge.ExecuteNestedGroup(SetPrintTable(), SetPrintCommand())
document.Save("x.doc")

Dim converter As DocToPDFConverter = New DocToPDFConverter()
Dim pdfDoc As PdfDocument = converter.ConvertToPDF(document)

i still able to see the empty paragraph.
attached are the word template file, the file result in word format, and the file result in pdf format.

Any advice?

Karina Tasha



Training_Schedule_List_f1623ff6.zip

3 Replies

PR Poornima R Syncfusion Team January 9, 2012 06:14 AM UTC

Hi Karina,

Thank you for your interest in Syncfusion Products.

We could able to reproduce the mentioned issue with the “Preservation of empty paragraph in the converted Pdf even after setting MailMerge.RemoveEmpty paragraph as true value.”. Could you please report this issue through Direct Trac Developer Support System https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents ), because you can take the advantage of the expertise of a dedicated support engineer and a guaranteed response time and we hope you will take advantage of this system as well? Please ignore if you have already reported this issue.

As a work around, please try converting the saved word document (x.doc) into pdf instead of converting document object into Pdf and let us know whether the mentioned issue is resolved.

Modified code snippet:
Dim document As New WordDocument
document = New WordDocument("..\x.doc")
document.MailMerge.RemoveEmptyParagraphs = True
document.MailMerge.ExecuteNestedGroup(SetPrintTable(), SetPrintCommand())
document.Save("x.doc")

Dim converter As DocToPDFConverter = New DocToPDFConverter()
Dim pdfDoc As PdfDocument = converter.ConvertToPDF("x.doc")

Please find the sample from the below link illustrating the same. Try running the sample and let us know if this helps you.
Sample:
SampleDocIO-572680974.zip

Please let us know if you have any questions.

Regards,
Poornima




TA Tasha January 13, 2012 09:57 AM UTC

Hi Support

thanks for the update.. it works perfectly!!!

Karina Tasha



DY Deivaselvan Y Syncfusion Team January 17, 2012 04:26 AM UTC

Hi Karina,

Thank you for your update.

Please let us know if you have any other questions.

Regards,
Deiva selvan




Loader.
Live Chat Icon For mobile
Up arrow icon