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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Docio - Removing blank line

Thread ID:





150418 Jan 6,2020 05:11 PM UTC Jan 7,2020 04:38 PM UTC WinForms 1
Tags: DocIO
Travis Chambers
Asked On January 6, 2020 05:11 PM UTC

Good day,

I am attempting to create a small app that will push data from an entry form into bookmarks in a word doc. However, when a field is left blank, and therefore a bookmark is left blank, I would like to have the line that the bookmark is in be removed if there is no other text in the line.

So, if the page looked like this:

Line 1

If [Bookmark] is blank and since there is no other text in that line, I want it to appear like this:

Line 1

Right now, if the bookmark is left blank it appears with a blank row like this:

Line 1

Line 2

Is it possible to identify the row that the bookmark is in and determine that no text exists in the row and then delete that row?


Suriya Balamurugan [Syncfusion]
Replied On January 7, 2020 04:38 PM UTC

Hi Travis,

Thank you for contacting Syncfusion support.

It is feasible to identify the replaced bookmark content contains text or not and remove that bookmark paragraph from the Word document.

We have prepared a sample application to remove the blank paragraph after replacing the bookmark content in the Word document as per your requirement and it can be downloaded from the below link:


Note: Please find the template Word document in the “Data” folder of above sample.

We have done the following things in the sample:
  1. Loads a template Word document.
  2. Moves to the location before the end of the specified bookmark in the document.
  3. Replaces the bookmark content with empty string (Here you can replace the bookmark content with data from an entry form).
  4. Gets the paragraph contains the specified bookmark.
  5. Removes that paragraph when it doesn’t contain text.
  6. Saves the Word document.

Please let us know if you have any other questions.

Suriya Balamurugan.


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.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon