Hello ashok,

On Saturday 31 January 2009 19:46, ashok _ wrote:
> I am running OOo 3.0 ... 

on DEV300_m40 it works both with the Content property, or getting the note's 
TextRange, creating a text cursor, and inserting text:

Sub Demo_1
        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


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




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: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to