Salve a tutti, come da oggetto vorrei sviluppare una macro che mi prenda
il paragrafo che inizia in un determinato segnalibro e che faccia un
cut&paste del testo dal segnalibro iniziale ad un altro segnalibro che si
trova nel footer del documento.
Questo รจ il codice che ho scritto:
-------------------------------------------------
bmks = ThisComponent.getBookMarks
If bmks.hasByName("CodInterno") then
p = ThisComponent.getBookmarks.getByName("CodInterno")
oTC = ThisComponent.Text.CreateTextCursorByRange(p.Anchor)
oTC.gotoStartOfParagraph(false)
oTC.gotoEndOfParagraph(true)
Stringa = oTC.getString()
'print Stringa
dispatcher.executeDispatch(document, ".uno:Cut", "", 0, Array())
'xray oTC
ToCopy = oTC.getString()
oTC.setstring("")
If bmks.hasByName("CodInternoFooter") then
print "Ho il footer"
'xray bmks
p = ThisComponent.getBookmarks.getByName("CodInternoFooter")
oTC = ThisComponent.Text.CreateTextCursorByRange(p.Anchor)
oTC.gotoStartOfParagraph(false)
oTC.gotoEndOfParagraph(true)
dispatcher.executeDispatch(document, ".uno:Paste", "", 0,
Array())
'print oTC.getString()
'xray oTC
Else
End If
End If
---------------------------------------------------------------------------
Ma la seguente riga mi ritorna un RunTimeErrore con messaggio vuoto.
p = ThisComponent.getBookmarks.getByName("CodInternoFooter")
oTC = ThisComponent.Text.CreateTextCursorByRange(p.Anchor)
Grazie a chiunque mi aiuti
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]