Setting Content Properties

From Apache OpenOffice Wiki
Jump to: navigation, search

A UCB content maintains a set of properties. It supports the command "setPropertyValues", that is used to set one or more property values of a content. This command takes a sequence of and returns void. To set property values of a UCB content:

  •  ::Define a sequence of property values you want to set.
  •  ::Let the UCB content execute the command "setPropertyValues".

Note that the command is not aborted if one or more of the property values cannot be set, because the requested property is not supported by the content or because it is read-only. Currently, there is no other method to check if a property value was set successfully other than to obtain the property value after a set-operation. This may change when status information could be returned by the command "setPropertyValues".

Setting property values of a UCB content:

      XContent xContent = ...
      String aNewTitle = "NewTitle";
      // Set value of the string property Title...
      // Define property value sequence.
      PropertyValue[] aProps = new PropertyValue[ 1 ];
      PropertyValue aProp = new PropertyValue();
      aProp.Name = "Title";
      aProp.Handle = -1;// n/a
      aProp.Value = aNewTitle;
      aProps[0] = aProp;
      try {
          // Execute command "setPropertyValues".
          // using helper method executeCommand (see [CHAPTER:UCB.Using.Commands]).
          executeCommand(xContent, "setPropertyValues", aProps);
      catch ( e) {
          ... error ...
      catch ( e) {
          ... error ...
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages