To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=58667
------- Additional comments from [EMAIL PROTECTED] Fri Jun 22 12:26:12 +0000
2007 -------
Hi,
i've got the same problem using the property "TextUserDefinedAttributes" of a
selected Text.
i'm using the following macro to store and read an attribute.
there is NO problem if i don't close the document. but if you take look in
"content.xml" of a close document, you could see that there is an
automatic-sytle withe the added attribute, but no reference from the selected
text.
Sub Main
Dim oDoc : oDoc = ThisComponent
Dim oText : oText = oDoc.getText()
Dim oTextCursor : oTextCursor = oText.createTextCursor()
Dim oVisibleCursor : oVisibleCursor =
oDoc.getCurrentcontroller().getViewCursor()
Dim oSels : oSels = ThisComponent.CurrentSelection
If Not IsNull(oSels) Then
Dim lSelCount : lSelCount = oSels.getCount()
Dim lWhichSelection
For lWhichSelection = 0 To lSelCount - 1
Dim oSel : oSel = oSels.getByIndex(lWhichSelection)
oSel.TextUserDefinedAttributes =
AddAttribute(oSel.TextUserDefinedAttributes
, "foo", "bar")
'MsgBox
GetAttributeValue(oSel.TextUserDefinedAttributes , "foo")
Next
End If
End Sub
Function GetAttributeValue(AttributeContainer As
com.sun.star.xml.AttributeContainer, AttributeName As String) As String
Dim Attribute As Object
GetAttributeValue = ""
If AttributeContainer.hasByName(AttributeName) Then
Attribute = AttributeContainer.getByName(AttributeName)
GetAttributeValue = Attribute.Value
End If
End Function
Function AddAttribute(AttributeContainer As com.sun.star.xml.AttributeContainer,
AttributeName As String, AttributeValue As String)
Dim oMyAttribute As Object
oMyAttribute = createUnoStruct("com.sun.star.xml.AttributeData")
With oMyAttribute
.Namespace = ""
.Type = "CDATA"
.Value = AttributeValue
End With
If AttributeContainer.hasByName(AttributeName) Then
AttributeContainer.removeByName(AttributeName, oMyAttribute)
AttributeContainer.insertByName(AttributeName, oMyAttribute)
Else
AttributeContainer.insertByName(AttributeName, oMyAttribute)
End If
AddAttribute = AttributeContainer
End Function
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]