[Solved] Can't change a bookmarked word in a table in Writer
Posted: Thu Mar 09, 2017 9:51 pm
Hi
I can change word outside in table but can't change inside in table in Writer Document.
This code works
But when I move the "Dog" word into a table, code does not change it to "Cad"
Thanks for your help
I can change word outside in table but can't change inside in table in Writer Document.
This code works
Code: Select all
Sub ChangeWord
dim oDoc as object
dim oVal()
dim Bookmarks,oAnchor,oCurs as object
url="D:\work.odt"
oDoc=StarDesktop.LoadComponentFromURL(ConvertToURL(url),"_blank",0,oVal())
Bookmarks=oDoc.getBookmarks()
oAnchor = Bookmarks.getByName("Dog").getAnchor()
oCurs = oDoc.getCurrentController().getViewCursor()
oCurs.gotoRange(oAnchor, False)
oCurs.String ="Cad"
End Sub
Code: Select all
Sub ChangeWord
dim oDoc as object
dim oVal()
dim Bookmarks,oAnchor,oCurs as object
dim oTable as object
url="D:\work.odt"
oDoc=StarDesktop.LoadComponentFromURL(ConvertToURL(url),"_blank",0,oVal())
Bookmarks=oDoc.getBookmarks()
oAnchor = Bookmarks.getByName("Dog").getAnchor()
oCurs = oDoc.getCurrentController().getViewCursor()
oCurs.gotoRange(oAnchor, False)
oCurs.String ="Cad"
End Sub