lookupStyle: Looking up a Style Definition by Id

lookupStyleR Documentation

Looking up a Style Definition by Id

Description

This function accepts style definition documents from two Word 07 archives and attempts to match a style definition to the id passed into it. If the style definition is found in the second document, the function either returns the style definition node, or adds the definition to the first style definition document.

Usage

lookupStyle(id, doc.styles, other.styles, add = TRUE)

Arguments

id

Id, not name, of the style whose definition should be looked up. A style's id is generally the name of the style, with any whitespace removed.

doc.styles

this is the main style definition document, generally extracted from a wordArchive that is being actively worked on. If the add paramter is true, this is the document to which the style definition will be added.

other.styles

generally a .dotm file containing additional style definitions that may be needed but may not already appear in the wordArchive being worked on.

add

a logical value indicating whether the style definition should be added to doc.styles (if necessary).

Details

This function first attempts to find a definition for a style with id style.id in doc.styles. Upon failing that, it seeks the definition in other.styles.

If the style is not found in either place, the function will raise an error.

Value

If the style is found ing doc.styles, the function returns NA. If the style is found in other.styles, the function returns either the style definition node, or the modified doc.styles, depending on the add parameter.

Author(s)

Gabriel Becker

References

ISO/Microsoft OOXML Specification

See Also

addStyleToNode, paragraph


duncantl/RWordXML documentation built on Nov. 23, 2023, 4:23 p.m.