wordDoc: Create object providing access to contents of a Word .docx...

View source: R/code.R

wordDocR Documentation

Create object providing access to contents of a Word .docx file

Description

This function is a constructor function for creating an R object that references a .docx file. With this object, we can then access many different aspects of the Word file's content such as the text, tables, images, the comments, styles. We can also update the contents of document and auxiliary files.

This function returns an object which refers to the .docx file. As that file changes, subsequent operations on the R object retrieve the updated contents. This can be good or bad depending on the context and how the document is being updated.

Usage

wordDoc(f, create = FALSE, class = "WordArchive")

Arguments

f

the full name of the .docx file. ~ is expanded via path.expand

create

a logical value. If the file f does not exist and create is TRUE an "empty" template .docx file is created with the name f.

class

a character string giving the name of the S4 class to create. The default is typically used. However, this parameter allows other constructor functions customize the class of the result. The class should derive from WordArchive, or at least ZipFileArchive

Value

An object of class given by the class argument. This is an object that typically derives from WordArchive.

Author(s)

Duncan Temple Lang duncan@wald.ucdavis.edu

See Also

creator, properties

Examples

  
f = system.file("SampleDocs", "RWordDocTools.docx", package = "RWordXML")
doc = wordDoc(f)
properties(doc)
creator(doc)
created(doc)
getStyles(doc)
        

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