MsOffice::Word::Surgeon::Text - internal representation for a node of literal text
This is used internally by MsOffice::Word::Surgeon for storing a chunk of literal text in a MsWord document. It loosely corresponds to a <w:t> node in OOXML, but may also contain an anonymous XML fragment which is the part of the document just before the <w:t> node -- used for reconstructing the complete document after having changed the contents of some text nodes.
<w:t>
my $text_node = MsOffice::Word::Surgeon::Text( xml_before => $xml_string, literal_text => $text_string, );
Constructor for a new text object. Arguments are :
A string containing arbitrary XML preceding that text node in the complete document. The string may be empty but must be present.
A string of literal text.
my $xml = $text_node->as_xml;
Returns the XML representation of that text node. The attribute xml:space="preserve" is automatically added if the literal text starts of ends with a space character.
xml:space="preserve"
$text_node->merge($next_text_node);
Merge the contents of $next_text_node together with the current text node. This is only possible if the next text node has an empty xml_before attribute; if this condition is not met, an exception is raised.
$next_text_node
xml_before
my $xml = $text_node->replace($pattern, $replacement_callback, %args);
Replaces all occurrences of $pattern within the text node by a new string computed by $replacement_callback, and returns a new xml string corresponding to the result of all these replacements. This is the internal implementation for public method "replace" in MsOffice::Word::Surgeon.
$pattern
$replacement_callback
Puts the literal text within the node into uppercase letters.
Laurent Dami, <dami AT cpan DOT org<gt>
Copyright 2019-2022 by Laurent Dami.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install MsOffice::Word::Surgeon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MsOffice::Word::Surgeon
CPAN shell
perl -MCPAN -e shell install MsOffice::Word::Surgeon
For more information on module installation, please visit the detailed CPAN module installation guide.