Aller au contenu principal
Version: 20 R7 BETA

WP RESET ATTRIBUTES

WP RESET ATTRIBUTES ( targetObj ; attribName {; attribName2 ; ... ; attribNameN} )
WP RESET ATTRIBUTES ( section {; attribName }{; attribName2 ; ... ; attribNameN} )

ParamètresTypeDescription
targetObjObjectRange or element or 4D Write Pro document
sectionOrSubsectionObjectSection or subsection of a 4D Write Pro document
attribNameStringName of attribute(s) to remove

Description

The WP RESET ATTRIBUTES command allows you to reset the value of one or more attributes in the range, element, or document passed as parameter. This command can remove any kind of 4D Write Pro internal attribute: character, paragraph, document, table, or image. You can pass the attribute name to be reset in attribName or, in the case of a section or a subsection, the sectionOrSubsection object can be passed alone and all the attributes are reset at once.

In the targetObj parameter, you can pass either:

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

When an attribute value is removed using the WP RESET ATTRIBUTES command, the default value is applied to targetObj or sectionOrSubsection. Default values are listed in the 4D Write Pro Attributes section.

Notes
  • When WP RESET ATTRIBUTES is applied to a section/sub-section object, attributes are then inherited from the parent section or document.
  • When WP RESET ATTRIBUTES is applied to a style sheet object, the attributes are removed from the style sheet unless it is the default ("Normal") style sheet. In this case, the default value is applied to the attribute (the "Normal" style sheet defines all style sheet attributes).
  • When sectionOrSubsection is not a section nor a subsection and if no attribute is provided, then an error is raised.

If the attribute to be reset was not defined in the element passed as a parameter, the command does nothing.

Exemple 1

You want to remove several attributes from the following selection:

You can execute:

 $range:=WP Get selection(*;"WParea")
WP RESET ATTRIBUTES($range;wk padding)
WP RESET ATTRIBUTES($range;wk background color)
WP RESET ATTRIBUTES($range;wk text underline style)
WP RESET ATTRIBUTES($range;wk margin)
WP RESET ATTRIBUTES($range;wk border style)

The resulting document is:

Exemple 2

$section:=WP Get section($document; 3)
WP RESET ATTRIBUTES($section) // All attributes of the section are removed
$subSection:=WP Get subsection(WP Get section($document; 3); wk left page)
WP RESET ATTRIBUTES($subSection) // All attributes of the subSection are removed

Voir également

4D Write Pro Attributes
WP GET ATTRIBUTES
WP SET ATTRIBUTES