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

Unable to add text at a bookmark because the bookmark is missing the "End"

I am trying to insert text at a bookmark using the following code:

bookmarkNav.MoveToBookmark(bookmarkName)
bookmarkNav.InsertText(value, True)

This works fine for all the bookmarks except 1 specifically. When looking at the bookmarkNav values during debug it shows that the BookmarkEnd is null, the BookmarkStart is not null. 

When I try to do the InsertText I get a NullReferenceException.

SyncfusionDocIO.DLS.Bookmark.BookmarkEnd.get returned nothing.

Why would there be a valid start but no valid end? How can I deal with this short of modifying the document in Word first?(not an option for me)

7 Replies

PR Poorani Rajendran Syncfusion Team September 23, 2019 09:37 AM UTC

Hi John,

Thank you for contacting Syncfusion support.

We have tried to reproduce the reported problem, but it works properly at our end. For your reference, we have attached the sample application which we tried at our end and it can be downloaded from the below link:
https://www.syncfusion.com/downloads/support/forum/147714/ze/CreateWordDocument2035447717

Note: Please find the input files in “Data” folder of above sample application.

We suspect that the problem might be due to the input Word document and code snippet used at your end. So, could you please share us the input Word document and complete code snippet with modified sample of above to reproduce the issue. Based on the details, we will check on your problem and will share you the solution at the earliest.

Please let us know if you have any other questions.

Regards,
Poorani Rajendran



JS John Stemper September 23, 2019 03:23 PM UTC

I've attached an example of the document that does not work.
The bookmark in question is ADDR2 
It has a bookmark start but not a bookmark end. I believe it has something to do with the anchored text area next to it.


PR Poorani Rajendran Syncfusion Team September 24, 2019 08:15 AM UTC

 Hi John,

Thank you for your update.

Regarding I've attached an example of the document:

We have not found any of your attachments in your previous update (Updated on 9/23/2019). Could you please re-upload the issue reproducing document. Thereby, we will check on your problem and will provide you the appropriate solution at the earliest.

Please let us know if you have any other questions.

Regards,
Poorani Rajendran
 



JS John Stemper October 1, 2019 12:36 PM UTC

I've attached a valid word document that shows the problem described above.

Attachment: JCSIFC_7c60a0b2.zip


PR Poorani Rajendran Syncfusion Team October 2, 2019 07:33 AM UTC

Hi John,

Thank you for your update.

We have tried to reproduce the reported problem with given input document, but it works properly at our end. For your reference, we have attached the sample application which we tried at our end and it can be downloaded from the below link:
https://www.syncfusion.com/downloads/support/forum/147714/ze/CreateWordDocument-1557976768

Note: Please find the input files in “Data” folder of above sample application.

We suspect that the problem might be due to the code snippet used at your end. So, could you please share us the modified sample application of above to reproduce the issue. Based on the details, we will check on your problem and will share you the solution at the earliest.

Please let us know if you have any other questions.

Regards,
Poorani Rajendran



JS John Stemper October 3, 2019 02:22 PM UTC

The original sample file was incorrect. I've attached the correct sample file.
I have confirmed that using the sample code you provided this docx file does not work either.


Attachment: JCSIFC_840856a5.zip


PR Poorani Rajendran Syncfusion Team October 4, 2019 09:31 AM UTC

Hi John,

Thank you for your update.

We have updated the details for your query in the support incident which has been created under your account to track the status of this issue. Please log on to our support website to check for further updates.
https://www.syncfusion.com/support/directtrac/incidents

Regards,
Poorani Rajendran

Loader.
Live Chat Icon For mobile
Up arrow icon