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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Deleting ranges with DeleteBookmarkContent

Thread ID:

Created:

Updated:

Platform:

Replies:

142273 Jan 24,2019 10:58 AM UTC Jan 2,2020 01:46 PM UTC WinForms 23
loading
Tags: DocIO
Florider
Asked On January 24, 2019 10:58 AM UTC

Hello,

I’m facing a problem when i try to delete properly a range delimited by a bookmark in a word document.
I use the DeleteBookmarkContent method from a bookmarkNavigator instance.
The output result seems visually correct (the specified range is deleted) but in details I notice that some bookmarks (outside the range) are lost.
I attached you a sample project with a word document (test.doc).
The test document contains 2 main ranges delimited by 2 bookmarks (ptabA and ptabB).
Each main range contains other bookmarks (tabA and tabB to enclose tables, tabA1Col1, tabA1Col2 …. to enclose cells).

After the DeleteBookmarkContent call on ptabA bookmark, you will notice that :
- tabA1 bookmark is preserved => it should have been deleted because it was inside the range to delete
- ptabA2 bookmark is lost => it should have been preserved because it was outside the range to delete

 This is only a sample doc, but I have hundred of doc templates containing this kind of structure / range which I delete dynamically (with Word interop).
I’m not able to explain this behavior and I didn’t find a way to resolve it.
Please, could you give me a sample to get the right output result ?

I made another test with same code and the test document converted to docx (test.docx).
Strangely the ouput result is a bit different :

-    tabA1 bookmark is well deleted
-    ptabA2 bookmark is still lost

Could you also explain me why the result is different depending on the doc / docx version used ?
For now everything worked well with the doc format and your library (I’m currently testing your product) and didn’t plan to convert all my doc templates to docx.
Based on this behavior, should I reconsider this point ?

Best regards ,

Flo

 


Attachment: testDocIORange_cb4d6279.zip

Dilli Babu Nandha Gopal [Syncfusion]
Replied On January 30, 2019 03:01 PM UTC

Hi Flo, 

We have confirmed that the reported issue with “Nested bookmarks are deleted improperly” is defect. The issue fix for this issue will be included in our 2019 Volume 1 SP1 which is estimated to be available by April 2019 tentatively. 

Regards, 
Dilli babu. 


Florider
Replied On January 30, 2019 04:34 PM UTC

Thanks for your answer.

Please, could you give me more details on the issue ? Because i reported you 2 different behavior / result with the same code depending on the document format (doc / docx).
At least could you confirm me the issue will be resolved on both formats ?

Best regards,

Flo

Dilli Babu Nandha Gopal [Syncfusion]
Replied On January 31, 2019 06:33 PM UTC

Hi Flo, 

Yes, the reported issue with “Nested bookmarks are deleted improperly” will be resolved on both formats and the same will be included in our 2019 Volume 1 SP1 which is estimated to be available by April 2019 tentatively. 

Regards, 
Dilli babu. 


Florider
Replied On April 3, 2019 09:20 AM UTC

Hello,

I saw a lot of fixes on DocIO in your last release (17.1.0.38) but nothing about this issue.
Can you confirm it will be fixed in your 2019 Volume 1 SP1 ? Any release date ?

Best Regards,

Flo

Abirami Varadharajan [Syncfusion]
Replied On April 4, 2019 05:31 AM UTC

Hi Florider, 

As promised earlier we will include the fix for “Nested bookmarks are deleted improperly” in 17.1 SP – 1 release which will be rolled out by mid of May 2019. 

Regards, 
Abirami 


Vijayasurya Anandhan [Syncfusion]
Replied On May 14, 2019 04:27 PM UTC

Hi Florider,

We regret for the inconvenience caused. Due to internal concerns we were unable to include these fixes in 2019 Volume 1 SP1 release. We will include this fix in our upcoming release 2019 Volume 2 release which is expected to be rolled out by end of June 2019.

Regards,
Mohanaselvam J


Florider
Replied On July 9, 2019 04:12 PM UTC

Hi, 

We are now in July and still waiting for a fix ..
Any news ?

Flo




Poorani Rajendran [Syncfusion]
Replied On July 10, 2019 09:18 AM UTC

Hi Florider,

We regret for the inconvenience

We are glad to inform that we are in final stage of our 2019 Volume 2 release which is expected to be rolled out by end of this week and also this fix will be included in that release.

Regards,
Poorani Rajendran


AtliDev
Replied On July 31, 2019 12:26 PM UTC

hi,
thanks for the release, now i fix the first probleme.
when i'm working with the deletebookmarkcontent i found an other problem ,
i have two bookmarks [[test]]
when i deletecontent of the first one , i have an empty text but the second bookmark is not delete??
can i have a explain and solution to this problem !!

the code:
        Dim a As WordDocument = New WordDocument(chemin + "\testword\sample.doc", FormatType.Doc)
        Dim bknav As New BookmarksNavigator(a)
        bknav.MoveToBookmark("liste")
        Dim bk As DLS.Bookmark = bknav.CurrentBookmark
        bknav.DeleteBookmarkContent(True)
        a.Bookmarks.Remove(bk)
i put a sample in the attach.
thanks

Attachment: sample_ce3d8956.zip

AtliDev
Replied On August 5, 2019 07:30 AM UTC

 hi,
i found an other problem of delete content,
the first case when the two bookmark start at the same place.
the second case is when i have two crossing bookmark.

the code :
        '' case 1
        ''Dim bknav As New BookmarksNavigator(a)
        ''bknav.MoveToBookmark("rangeTab1")
        ''bknav.DeleteBookmarkContent(False)
        ''a.Bookmarks.Remove(bknav.CurrentBookmark)

        ''bknav = New BookmarksNavigator(a)
        ''bknav.MoveToBookmark("rangeRangeTab1")
        ''bknav.DeleteBookmarkContent(False)
        ''a.Bookmarks.Remove(bknav.CurrentBookmark)


        '' case 2
        ''Dim bknav As New BookmarksNavigator(a)
        ''bknav.MoveToBookmark("RangeRecoAC1")
        ''bknav.DeleteBookmarkContent(False)
        ''a.Bookmarks.Remove(bknav.CurrentBookmark)

        ''bknav = New BookmarksNavigator(a)
        ''bknav.MoveToBookmark("RangeRecoAC2")
        ''bknav.DeleteBookmarkContent(False)
        ''a.Bookmarks.Remove(bknav.CurrentBookmark)


i put a sample in the attach file.

thanks for help

Attachment: sample_4a9a20e8.zip

Mohanaselvam  Jothi [Syncfusion]
Replied On August 5, 2019 04:16 PM UTC

Hi AtliDev,

Thank you for your update.
 
Queries 
Details 
Regarding the issue (Updated on 7/31/2019) 
We have confirmed that the reported “Nested bookmark not deleted while deleting bookmark content in Word document” is an issue and we have logged a defect report.

The fix for this issue will be included in our 2019 Volume 3 release which is expected to be available at the end of September, tentatively.
 
Regarding the issue (Updated on 8/5/2019) 
We can reproduce that the bookmarks are removed improperly (both case 1 and case 2) while deleting bookmark content in the given Word document. We will validate on this and will provide you more details on 7th August 2019. 

Please let us know if you have any other questions.

Regards,
Mohanaselvam J
 


Poorani Rajendran [Syncfusion]
Replied On August 7, 2019 04:24 PM UTC

Hi AtliDev,

Thank you for your patience,

Regarding the issue bookmark are removed improperly (
Updated on 8/5/2019):
We have confirmed that the reported “Bookmark not removed properly while resaving the Word document” is an issue and we have logged a defect report.

The fix for this issue will be included in our 2019 Volume 3 release which is expected to be available at the end of September, tentatively.


The status of this bug can be tracked through the below link:
https://www.syncfusion.com/feedback/8067/bookmark-not-removed-properly-while-open-and-save-the-word-document

Regarding “Nested bookmark not deleted while deleting bookmark content in Word document”:
The status of this bug can be tracked through the below link:
https://www.syncfusion.com/feedback/8000/nested-bookmark-is-not-deleted-properly-while-deleting-a-bookmark-content

Please let us know if you have any other questions.

Regards,
Poorani Rajendran


Florider
Replied On August 8, 2019 12:09 PM UTC

Hi,

Please, could you try to fix this problem globally. We sent you several examples but it’s hard to describe every possible case.
I guess it's not an easy work for you, but the behavior should be identical to MS Word one (even if the deleted range contains bookmarks that start or end outside this range).
We use this delete range principle in many models to be able to adjust the document content dynamically during the reporting process.
And since we can not update all our customers models, for the moment we can not use your library to process these models.
So we really hope the next release would be the good one 😊

Best Regards, 

Flo


Poorani Rajendran [Syncfusion]
Replied On August 10, 2019 11:23 AM UTC

Hi Florider,

Thank you for your valuable feedback, we will address your feedback with high priority and we will implement the fix in generic manner. The fix for this issue will be included in our 2019 Volume 3 release which is expected to be available at the end of September, tentatively.

Please let us know if you have any other questions.

Regards,
Poorani Rajendran


Florider
Replied On September 23, 2019 03:20 PM UTC

Hi,

Is your last release (17.3.0.9) supposed to contain theses fixes ? Because i can't find the ticket id in the release note ...

Best Regards,

Flo

Poorani Rajendran [Syncfusion]
Replied On September 24, 2019 11:23 AM UTC

Hi Florider,

Thank you for your update
.

We have not included the fix for Bookmark not removed properly while resaving the Word document in our latest 2019 Volume 3 Beta release (v17.3.0.9),

As we promised earlier, we will include this fix in our upcoming 2019 Volume 3 main release, which is expected to be available at October, 2019 tentatively.

Regards,
Poorani Rajendran


AtliDev
Replied On November 15, 2019 05:42 PM UTC

hi, 
thanks for helping us to solve this issu.
i found a other problem where i try to delete.

when i delete some range i lose the bookmarkend of my X bookmark, 
so when i try to delete the bookmark X, it display an error.

i give bellow the code that i use.
and attached the document for test.

     Private Sub TestSuppressionPlage(sender As Object, e As EventArgs) Handles UiButton21.Click
        Dim a As WordDocument = New WordDocument(chemin + "\testword\CasSuppressionPlageReco\matriceAmianteDTA.doc", FormatType.Doc)
        SupprimerRange("plageTableauHCI", a)
        SupprimerRange("plageRecoAC2", a)
        SupprimerRange("plageRecoProprio", a)
        a.Save(chemin + "\testword\CasSuppressionPlageReco\result.doc", FormatType.Doc)
        a.Close()
        Process.Start(chemin + "\testword\CasSuppressionPlageReco\result.doc")
    End Sub

    Private Sub SupprimerRange(nomSignet As String, workdocument As WordDocument)
        Dim bknav As BookmarksNavigator = New BookmarksNavigator(workdocument)
        bknav.MoveToBookmark(nomSignet)
        bknav.DeleteBookmarkContent(True)
        workdocument.Bookmarks.Remove(bknav.CurrentBookmark)
        bknav = Nothing
    End Sub


thanks for helping :) 

Attachment: matriceAmianteDTA_1ad15515.rar

Poorani Rajendran [Syncfusion]
Replied On November 18, 2019 06:47 AM UTC

Hi AtliDev,

Thank you for your update.

We can reproduce the reported problem while deleting bookmark content in Word document. We will validate on the reported problem and update you more details about this on 20th November, 2019.

Please let us know if you have any other questions.

Regards,
Poorani Rajendran


Suriya Balamurugan [Syncfusion]
Replied On November 20, 2019 03:41 PM UTC

Hi AtliDev,

Thank you for your patience.

We have confirmed that the reported “NullReferenceException issue while deleting bookmark content in Word document” is a defect and the fix for the issue will be included in our upcoming 2019 Volume 4 main release, which is expected to be available at December, 2019.

Please let us know if you have any other questions.

Regards,
Suriya Balamurugan.


ATLIDEV
Replied On December 20, 2019 04:56 PM UTC

Hello,

I didn't find my ticket into your last release note (17.4.0.39 (Volume 4 2019)
=> Can you please verify that this ticket has been taken into account ?

Best regards

Flo

Suganya Rathinam [Syncfusion]
Replied On December 23, 2019 06:01 AM UTC

Hi Flo,

We regret for not including the fix “NullReferenceException issue while deleting bookmark content in Word document” in 2019 Volume 4 release as we have promised earlier.

We faced few stability related issues in our complete automation testing while moving this fix by the end of release. So, we have reverted this fix from our release version. We will include this fix in our upcoming release 2019 Volume 4 SP1 which is expected to be rolled out by end of January 2020.

Regards,
Suganya R


ATLIDEV
Replied On December 31, 2019 10:57 AM UTC

Hello,

Once again, we hope that you will succeed in correcting this defect in a generic and definitive way because we have a lot of templates in which we dynamically delete ranges, and the configuration / layout is never exactly the same. For this reason you should not only work on the cases presented in this ticket.

However, the need is always the same and quite simple because we never cross bookmarks. By "crossing" we mean : [[...]......], which is a very complex and twisted case.
Excluding this case, deleting a range delimited by a bookmark should never result in the deletion of an object that is « visually » outside this range (especially bookmarks, even if they start or end at the edge of the deleted range). We know that your library doesn’t work like Word Automation, but we need the behavior / result to be exactly the same on this point.

Please, notice that the problem has been reported a year ago and we are still waiting for the fix to use your library in production.

Best regards,

Flo


Suriya Balamurugan [Syncfusion]
Replied On January 2, 2020 01:46 PM UTC

Hi Flo,

We regret for the inconvenience caused.

Thank you for your valuable feedback, we will address your feedback with high priority and we will implement the fix in generic manner for all possible combinations in bookmark as much as possible. The fix for the issues will be included in our upcoming release 2019 Volume 4 SP1 which is expected to be rolled out by end of January 2020.

Regards,
Suriya Balamurugan.
 


CONFIRMATION

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