Hi,
I have created a new topic though I did start a topic several months ago with the title 'How to get index of a paragraph' which did give me the answers. But now im getting an issue where i cannot get rid of the text where the picture is inserting to.
I have created a word doc please see attached file, but i cannot get rid of the text highlighted in blue after the picture, how do i get rid of this text?
This is my code so far:
Dim selections As TextSelection() = ActiveDocument.FindAllString(textSelections(0).SelectedText, True, True)
Dim imageData() As Byte = Nothing
Dim image As Image = Nothing
imageData = GetImageData(ImageId)
image = clsPictureManipulator.CreateImageFromByteArray(imageData)
Dim picture As New DocPicture(ActiveDocument)
picture.LoadImage(image)
For Each selection As TextSelection In selections
Dim range As TextRange = selection.GetAsOneRange()
Dim paragraph As Paragraph = range.OwnerParagraph
Dim index As Integer = paragraph.ChildObjects.IndexOf(range)
paragraph.ChildObjects.Insert(index, picture.Clone())
'If you also want to remove "|Image|" text, you can try this line.
'paragraph.ChildObjects.RemoveAt(index + 1)
Next
Where im doing the paragraph.ChildObjects.RemoveAt(index + 1) it is not removing the whole text selection it is leaving <156|Imae|> any ideas how to fix this?