toWordprocessingML: Converting R output to WordprocessingML

toWordprocessingMLR Documentation

Converting R output to WordprocessingML

Description

This function accepts an R object and converts it into a WordprocessingML node which can then be inserted into the document.xml file within a Microsoft Word 07 archive (.docx file).

Usage

toWordprocessingML(x, parent = NULL, inline = FALSE, doc = NULL, ...)

Arguments

x

the object to be converted into WordprocessingML

parent

the XML node, if any, which the resulting node should be added to.

inline

a logical value indicating whether the created node should be an inline node for insertion within a paragraph node.

doc

an optional XMLInternalDocument object in which the node is being added. This can provide the namespace definitions, etc.

...

additional arguments to be passed down to the specific method applied.

Details

A number of methods for this function ship with the RWordXML package, including a default which simply imitates the print method for the object (what is shown if you type the name of the object into the R console).

It is also possible to write custom methods for this function in order to completely control the formatting of the resulting node. See A New WPML Method.docx for an example of this.

Note: We have tried to ease the process where we can, but a cursory understanding of the XML package and the OOXML/WordprocessingML specification is necessary to write new methods.

Value

an XML node meeting the WordprocessingML specification.

Author(s)

Duncan Temple Lang

References

Microsoft/ISO OOXML specification

Examples

require(RWordXML)

atable <- table(sample(1:10, 100, replace=TRUE))
mynode <- toWordprocessingML(atable)
mynode


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