Apache OpenOffice (AOO) Bugzilla – Issue 12731
Annotation not in content enumeration
Last modified: 2013-02-24 21:09:29 UTC
1. add an annotation to a text range cur 2. cur.createContentEnumeration(...) returns an empty enumeration (see attachment) script prints: (u'com.sun.star.text.TextContent',) 0
Created attachment 5285 [details] script showing the error
This might be OOo 1.1 Beta 2 relevant
TL->SW: OS said an annotation is not part of the content enumeration. Thus this is OK. It should be part of the enumeration returned by createEnumeration though. Please check.
SW->TL: the textfield 'annotation' is part of the portionenumeration, but there seems to be a problem to get it after the annotation is freshly inserted. In the macro below the first element of the portion enumeration is the text itself, but after recreating the cursor it is the textfield. doc = stardesktop.loadComponentFromURL("private:factory/swriter","_blank", 0, dimArray()) BodyText = doc.getText() cur = BodyText.createTextCursor() cur.setString("Text") a = doc.createInstance("com.sun.star.text.TextField.Annotation") a.Author = "Dr. No" a.Content = "foobar" BodyText.insertTextContent(cur, a, False) enum = cur.createEnumeration() paragraph = enum.nextElement portions = paragraph.createEnumeration portion = portions.nextElement print portion.TextPortionType print "second try" BodyText = doc.getText() cur = BodyText.createTextCursor() enum = cur.createEnumeration() paragraph = enum.nextElement portions = paragraph.createEnumeration portion = portions.nextElement print portion.TextPortionType
SW: changed target
.
Everyting is as it should be. In the first step you created the enumeration directly after the insertTextContent (which had placed the cursor after the inserted text field at position 1) and in the second try you create a new cursor that starts before the text field (at position 0). If you recreated the cursor in the frist try *after* the insertTextContent call the order of the called code is the same and you'll get the same result.
Set to invalid.
closed as invalid