bookmark in a cell
Hi,
i'am always evaluate your product,
i have a table with two rows
the first one is the header and the second in empty
the first row containt cells with specific bookmark,
i want to recupere the cellindex of specific bookmark
i use the current code but he don't find any bookmark in cell just wtextrange.
//code
Dim bknav As BookmarksNavigator = New BookmarksNavigator(a)
bknav.MoveToBookmark("tableauAC1")
bknav.MoveToBookmark("tableauAC1")
Dim tbp As TextBodyPart = bknav.GetBookmarkContent
Dim table As WTable = Nothing
For Each element As IEntity In tbp.BodyItems
If TypeOf element Is WTable Then
table = CType(element, WTable)
Exit For
End If
Next
Dim table As WTable = Nothing
For Each element As IEntity In tbp.BodyItems
If TypeOf element Is WTable Then
table = CType(element, WTable)
Exit For
End If
Next
For Each cell As WTableCell In table.Rows(0).Cells
For Each para As WParagraph In cell.Paragraphs ' y a que paragraph a l'interieur
For Each element In para.ChildEntities
If TypeOf (element) Is BookmarkStart Then
bkname = TryCast(element, BookmarkStart).Name
currindex = cell.GetCellIndex
If bkname = "numLocalAC1" Then
indexNom = currindex
bktodelete.Add(bkname)
End If
If bkname = "localAC1" Then
indexPrenom = currindex
bktodelete.Add(bkname)
End If
If bkname = "numLotAC1" Then
indextelephone = currindex
bktodelete.Add(bkname)
End If
End If
Next
Next
Next
For Each para As WParagraph In cell.Paragraphs ' y a que paragraph a l'interieur
For Each element In para.ChildEntities
If TypeOf (element) Is BookmarkStart Then
bkname = TryCast(element, BookmarkStart).Name
currindex = cell.GetCellIndex
If bkname = "numLocalAC1" Then
indexNom = currindex
bktodelete.Add(bkname)
End If
If bkname = "localAC1" Then
indexPrenom = currindex
bktodelete.Add(bkname)
End If
If bkname = "numLotAC1" Then
indextelephone = currindex
bktodelete.Add(bkname)
End If
End If
Next
Next
Next
// end code
in piece joint you will find the document.
-------- ADD ------
after i use the 16.4 librairy the espion express don't give me any information.
thanks have a nice day
Attachment: exemple_93b491c5.zip
SIGN IN To post a reply.
1 Reply
VR
Vijay Ramachandran
Syncfusion Team
January 16, 2019 09:07 AM UTC
Hi AtliDev,
Thank you for contacting Syncfusion support.
You can get the bookmark owner cell index by using BookmarkNagivator. Please find the example code snippet from below and let us know if it helps.
Thank you for contacting Syncfusion support.
You can get the bookmark owner cell index by using BookmarkNagivator. Please find the example code snippet from below and let us know if it helps.
|
Dim document As WordDocument = New WordDocument("exemple.docx")
Dim bkmkNavigator As BookmarksNavigator = New BookmarksNavigator(document)
bkmkNavigator.MoveToBookmark("numLocalAC1")
Dim cellIndex As Integer = -1
If bkmkNavigator.CurrentBookmark IsNot Nothing AndAlso bkmkNavigator.CurrentBookmark.BookmarkStart IsNot Nothing Then
Dim ownerParagraph As WParagraph = bkmkNavigator.CurrentBookmark.BookmarkStart.OwnerParagraph
If ownerParagraph.IsInCell Then
Dim ownerCell As WTableCell = TryCast(ownerParagraph.OwnerTextBody, WTableCell)
If ownerCell IsNot Nothing Then cellIndex = ownerCell.GetCellIndex()
End If
End If |
You can find the runnable example project from below:
http://www.syncfusion.com/downloads/support/forum/141923/ze/Bookmark1881819878
Regards,
Vijay R
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
AT AtliDev
- Jan 10, 2019 02:41 PM UTC
- Jan 16, 2019 09:07 AM UTC