Flatten fields (W)

Modified on Mon, 5 Oct at 1:54 PM

This feature is a field-flattening function that flattens all fields that match the search criteria specified by the field-code and field-name parameters. If these two parameters are omitted, the function will flatten all document properties, i.e., their range is substituted with contained plain text, and delete associated custom document properties.

CMD

<Cmd case="BaseExtensions:FlattenFields"/>

Parameters

field-code

Define the field code that identifies the type of field, e.g., DOCPROPERTY, which is also the default value. Provide "*" to search all fields instead. As default only specific types of fields will be flattened. These types are: wdFieldDocProperty, wdFieldAutoText, wdFieldAutoTextList, wdFieldDate, wdFieldDocVariable, wdFieldEmpty, wdFieldMacroButton, wdFieldTime, wdFieldTitle, wdFieldUserAddress, wdFieldUserInitials, wdFieldUserName, and wdFieldTOC - according to the WdFieldType (see all here) enumeration.

If you want to force all field types to be flattened, see parameter force-all further down.

field-name

Define the extra field code that identify the field. Provide "*" to search all fields with the scope defined by field-code parameter. This is also the default value.

also-delete-reference

Define whether the field reference should be deleted as well using true or false. Currently, only referenced custom document properties matching the field-name parameter will be deleted.

Default value is true .

update-before-flattening

Define whether the command should update before the flattening occurs using true or false.

Default value is true.

lock-during-process

Define this parameter to true if the redrawing of the document window should be suspended during processing.

Default value is true.

undo-menu-name

Define the text to display in the undo menu.

Default value is "Flatten Fields".

protection-password

Define the password to provide for protected documents.

Default value is "" (an empty string).

message-title

Define the title of the dialog box that appears when the function is completed.

Default value is "Flatten Fields".

message-text-success

Define the text displayed upon function success.

Default value is "Flattening completed successfully".

message-text-already-flattened

Define the text displayed upon function success, but the function did not do anything.

Default value is "Fields in the document has already been flattened".

force-all

If set to true then all field types will be flattened. Default is false and will only flatten the field types described in the field-code parameter description.

Example of usage

An example of usage can be seen in Fredensborg Kommune.

XML
<Cmd case="BaseExtensions:FlattenFields"
     field-code="DOCPROPERTY"
     field-name="*"
     also-delete-reference="true"
     update-before-flattening="true"
     lock-during-process="true"
     protection-password=""
     message-title="Afslut dokument"
     message-text-success="Dokumentet er nu afsluttet. Der kan ikke længere flettes data fra Acadre."
     message-text-already-flattened="Enten er dokumentet allerede afsluttet eller også har dokumentet ingen flettefelter."
     undo-menu-name="Afslut dokument" />

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article