Hi *,
> Search options chosen on the "Search" dialog are made persistent, so do a
> search checking to search also in Notes.
> Then run the following code:
>
> Sub Main
> Dim oDoc
> oDoc = ThisComponent 'well... I simply suppose it's a Writer doc
>
> Dim oNote
> oNote = oDoc.createInstance("com.sun.star.text.textfield.Annotation")
> oNote.Author = "Homer J. Simpson"
> oNote.Content = "This is a demo"
>
> Dim oCursor
> oCursor = oDoc.getText().createTextCursor()
> oCursor.goToEnd(false)
>
> oDoc.getText().insertTextContent( oCursor, oNote, false )
> End Sub
answering a question on d...@api, found there is a different result when
inserting the text on the note via a text cursor, instead of the Content
property: no message at all
Sub Demo_2
Dim oDoc
oDoc = ThisComponent 'well... I simply suppose it's a Writer doc
Dim oNote
oNote = oDoc.createInstance("com.sun.star.text.textfield.Annotation")
oNote.Author = "Homer J. Simpson"
'oNote.Content = "This is a demo"
Dim oTextRange
oTextRange = oNote.TextRange
Dim oNoteCursor
oNoteCursor = oTextRange.getText().createTextCursor()
oTextRange.getText().insertString( oNoteCursor, "Hello...", False )
oTextRange.getText().insertControlCharacter( oNoteCursor,
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False )
oTextRange.getText().insertString( oNoteCursor, "...world", False )
Dim oCursor
oCursor = oDoc.getText().createTextCursor()
oCursor.goToEnd(false)
oDoc.getText().insertTextContent( oCursor, oNote, false )
End Sub
Side note: the new property TextRange seems to be undocumented in the IDL
http://svn.services.openoffice.org/ooo/tags/DEV300_m40/offapi/com/sun/star/text/textfield/Annotation.idl
Regards
--
Ariel Constenla-Haile
La Plata, Argentina
"Aus der Kriegsschule des Lebens
- Was mich nicht umbringt,
macht mich härter."
Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]