addList: Add a list to a Word document

addListR Documentation

Add a list to a Word document

Description

This function adds a Word list to a word processing document. It takes the R object and attempts to represent it as a list.

In the future, we should make this generic. Howver, the makeList function is the ont that creates the XML representation of the R object. So making this generic is more releated to doc and node and being able to add to a parsed XML document or to a particular place in the document, rather than just the archive. However, one can do this via node now.

Usage

addList(obj, doc, node = xmlRoot(doc[[getDocument(doc)]]), id = NA, lvl = 0, ..., inline = TRUE)

Arguments

obj

the R object which is to be displayed as a list in the Word document.

doc

the Word document, i.e. of class WordArchive-class

node

the node in the primary XML document within the Word archive at which to put this new node. The new list is added as a child of this node.

id

the identifier for the list that is used in the Word meta data to index this list.

lvl

the level of the list, i.e. the level of nesting.

...

additional parameters that are passed to the addListMetaData function.

inline

a logical value passed to makeList and which controls whether the content is add as a child of a w:r node or directly within a w:p node.

Value

The side-effect of updating the archive is the primary purpose of this function.

If we add methods for this function to update the parsed XML document, the archive will not be updated directly.

Author(s)

Duncan Temple Lang

Examples

 doc = wordDoc("doesNotExist.docx", create = TRUE)
 addList(c("Duncan", "John", "Naras"), doc)
 lists(doc) # doesn't work yet, but the content is display.

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