Seems not be be my day...
TextSection != Text...

Back to topic:
In some of my macros I use the UserDefinedAttributes of TextSections. To
store an Attribute i use the following 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 = "citDesigner"
    .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


The trick is to rewrite the Container to the section, eg.:
oSection.UserDefinedAttributes = AddAttribute(oSection.UserDefinedAttributes,
"foo", "bar")

i hope this does resolve your problems

Reply via email to