NAME

MsOffice::Word::Surgeon::Field - internal representation for a MsWord field

DESCRIPTION

This is used internally by MsOffice::Word::Surgeon for storing a MsWord field.

METHODS

new

my $field = MsOffice::Word::Surgeon::Field(
  xml_before  => $xml_string,
  code        => $code_instruction_string,
  result      => $xml_fragment,
  status      => 'begin',
);

Constructor for a new field object. Arguments are :

xml_before

A string containing arbitrary XML preceding that field in the complete document. The string may be empty but must be present.

code

A code containing the instruction string for that field. If the instruction string contains embedded fields, these are represented through the "show_embedded_field" in MsOffice::Word::Surgeon syntax -- by default, just a pair of curly braces.

result

An XML fragment corresponding to the last update of that field in MsWord.

status

One of begin, separate, or end.

Status begin or separate are intermediate, used internally during the parsing process. Normally all fields are in end status.

add_to_code

While parsing fields, additional field instruction fragments are added through this method

add_to_result

While parsing fields, additional XML fragments belonging to the field result are added through this method

type

The first instruction in the code part, eg REF, QUOTE, ASK, DOCPROPERTY, etc. Note : in the Microsoft Word Object Model, the https://learn.microsoft.com/en-us/office/vba/api/word.field.type|Field.Type attribute is an integer value in an enumerated type. Here the attribute is just an uppercase string. Lists of valild field types can be found in the Word documentation.

AUTHOR

Laurent Dami, <dami AT cpan DOT org<gt>

COPYRIGHT AND LICENSE

Copyright 2024 by Laurent Dami.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.