Finding a text values marked with Bookmarks

Hello,
 
I currently using DocIO and im trying to extract text values from a Word document.  The values are in a table formate and each cell contains a text value with a corresponding Bookmark assigned to it.  The reasoning for using bookmarks is that the Word document can contain x amount of tables.  So i thought creating bookmarks would be the easiest way to find the table values.
 
 The problem im having is that my code is able to find the Bookmark but the coorresponding text value is not correct.  Its seems that its grabing the value of the first cell not matter which Bookmark I search by.  When i go to "Bookmarks" in Word and select a Bookmark and click "Go To",  the correct value is highlighted (the bookmark point the corresponding value). 
 
I've attached a sample document with 3 bookmarks that DocIO is not finding the correct values.  Below is the code i'm using.  Can you provide any ideas as to why DocIO is not extracting the correct values?  Or can you provide a better way that i should be trying to find the values in a table?
 
Thanks for any help you can provide.
 

private string GetBookMarkValue(IWordDocument doc, string bookMarkName)

{

string value = "";

Bookmark bm = doc.Bookmarks[bookMarkName];

if (bm != null)

{

value = bm.BookmarkStart.OwnerParagraph.Text;

}

return value;

}



File_5e2f9f9e.zip

4 Replies

RM Ramkumar M Syncfusion Team July 17, 2012 09:21 AM UTC

Hi Brain                                  

Thank you for your interest in Syncfusion product

We have analyzed your document and found that you have added the bookmark by selecting cell instead of selecting text in the cell, by doing this bookmark start and end inserted over different textbody(cells) instead of in a single paragraph. Currently using DocIO it is not possible to get the content of bookmark if the bookmark start and end presents in different textbody(cells).

As a workaround select only the text in the cell and then add appropriate bookmark.  For your reference we have modified your document to place the bookmark start and end inside a single paragraph and prepared a video to illustrate this workaround. Please find the sample with modified document and the video from the following link and let us know if this helps you.

Modified document:

http://www.syncfusion.com/downloads/Support/DirectTrac/95371/Sample-872376323.zip

Video:                        

http://www.syncfusion.com/downloads/Support/DirectTrac/95371/workaround901824322.zip

Please let us know if you have any other questions.

Regards

Ramkumar



BA Brian Acierni July 19, 2012 04:39 AM UTC

wow...  thanks.  You were correct in that the bookmark was not being created correctly.  That table was being generated by some VBA code and it wasn't adding the bookmarks correctly.  Thanks for a quick reply and for the code example/video.
 
Top notch support!


RM Ramkumar M Syncfusion Team July 20, 2012 12:59 PM UTC

Hi Brain,


You're welcome. Please let us know if you have any other questions.


Regards,

Ramkumar



RM Ramkumar M Syncfusion Team July 20, 2012 12:59 PM UTC

Hi Brain,


You're welcome. Please let us know if you have any other questions.


Regards,

Ramkumar


Loader.
Up arrow icon