Document::OOXML::Part::WordprocessingML - WordprocessingML document part handling
version 0.181410
XML::LibXML::Document containing the parsed XML of the WordprocessingML part.
XML::LibXML::XPathContext that will be used to find elements in the WordprocessingML.
Create a new instance based on XML data.
Returns a list of <w:t> elements (see XML::LibXML::Element) matching the regular expression.
<w:t>
First, all adjacent identical runs are merged (see "merge_runs"), then all text elements are matched against the regular expression. The runs with matching text are then split into "pre-match", "match" and "post-match" parts. The "match" parts are then returned.
This regular expression should not contain matching groups, as this will confuse the splitting code.
If $exclude_tables is true, the regular expression will not match text in tables. This option may change in the future.
$exclude_tables
Sets the style options described by %style to all text parts of the document that match regular expression $regex.
%style
$regex
Internally, this method uses "find_text_nodes" to do the heavy lifting of combining and splitting runs.
The regular expression should not contain matching groups, as this will confuse the splitting code.
The following style options are recognised (all are optional, but why would you call this method if you don't want to set/unset styling?):
bold
Boolean value. If true, matching text will be made bold. If specified and false, matching text will be un-bolded.
italic
Boolean value. If true, matching text will be made italic. If specified and false, matching text will be un-italiced.
underline_style
String value. Matching text will get an underline of the specified style. If the key exists specified and the value is c<undef>, underline will be removed from the matching text.
Allowed underline styles are:
dash dashDotDotHeavy dashDotHeavy dashedHeavy dashLong dashLongHeavy dotDash dotDotDash dotted dottedHeavy double none single thick wave wavyDouble wavyHeavy words
underline_color
Color value that will be used for the underline only.
color
Color value, matching text will be given this color.
Colors should be in the format: RRGGBB (red, green, blue components in hexadecimal, like used in HTML). The special value auto can be used to let the word processor decide the color.
RRGGBB
auto
Note: unlike HTML, the color value should NOT be prefixed with "#". It should just be the six hexadecimal digits.
exclude_tables
Boolean value. If true, text in tables will not be touched.
Remove all <w:proofErr> elements from the document. This removes the red "squigglies" until another spelling/grammar check is done.
<w:proofErr>
Extract a list of words form the document.
Returns a reference to an array containing the words.
Walks over all runs (<w:r>) in the document. If two adjacent runs in the same paragraph have identical properties, the contents of the second run are merged into the first run.
<w:r>
This makes it easier to find stretches of text for search/replace.
Replace all occurrences of $search with $replace in every text (<w:t>) element in the document.
$search
$replace
Does not yet follow references, so text in headers, footers and other external parts of the document isn't changed.
Document::OOXML
Document::OOXML::Part
Martijn van de Streek <martijn@vandestreek.net>
This software is copyright (c) 2018 by Martijn van de Streek.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Document::OOXML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Document::OOXML
CPAN shell
perl -MCPAN -e shell install Document::OOXML
For more information on module installation, please visit the detailed CPAN module installation guide.