Saltar para o conteúdo principal
Versão: 20 R8 BETA

WP Get attributes

WP Get attributes ( targetObj ; attribName ; attribValue {; attribName2 ; attribValue2 ; ... ; attribNameN ; attribValueN} )
WP Get attributes ( targetObj ; attribColl ) : Object

ParâmetroTipoDescrição
targetObjObjectRange or element or 4D Write Pro document
attribNameTextName of attribute to get
attribValueText, Number, Array, Collection, Picture, DateCurrent value of attribute for the target
attribCollCollectionCollection of attribute names to get
ResultadoObjectAttribute names and values

Descrição

The WP Get attributes command returns the value of any attribute in a 4D Write Pro range, header, body, footer, table, or document. This command gives you access to any kind of 4D Write Pro internal attributes: character, paragraph, document, table, or image.

In targetObj, you can pass:

  • a range, or
  • an element (header / footer / body / table / paragraph / anchored or inline picture / section / subsection / style sheet), or
  • a 4D Write Pro document

In attribName, pass the name of the attribute you want to retrieve.

You can also pass a collection of attribute names in attribColl, in which case the command will return an object containing the attribute names passed in attribColl along with their corresponding values.

For a comprehensive list of attributes to pass, as well as their scope and values, please refer to the 4D Write Pro Attributes section.

If there are different values for the same attribute in the element passed as a parameter, the command returns:

  • for numerical values, wk mixed
  • for an array, an empty array (tab stops, color if attribValue is defined as array), with an exception for wk text shadow offset for which the array value will always contain 2 entries which may be set separately to wk mixed if either horizontal offset or vertical offset (or both) are mixed.
  • for string values, an empty string
  • for picture values, an empty picture.

Note: If targetObj contains a paragraph and a character style sheets, the paragraph style sheet name is returned.

Exemplo 1

You want to get the background color of the selected area:

 $range:=WP Selection range(*;"WParea")
WP Get attributes($range;wk background color;$bcol)

Exemplo 2

You want to get the font size, background color and border style of the selected area using a collection:

 $range:=WP Selection range(*;"WParea")
$collection:=New collection(wk font size; wk background color; wk border style)
$attributes:=WP Get attributes($range; $collection)

Veja também

WP RESET ATTRIBUTES
WP SET ATTRIBUTES