commentTable: Access the comments in the document

View source: R/code.R

commentTableR Documentation

Access the comments in the document

Description

These functions allow the caller to retrieve information about the comments in an Office Open document. We can get just the content of the comments, or the contents along with meta-information such as the date and author, or the XML nodes representing the comments. The last of these is useful if we want to programmatically modify the comments.

commentTable2 returns the content of the comments and also the styles associated with those comments. This information can be used to interpret the comments, e.g. as R code or R plot or R options. This functionality may be merged back into commentTable with a parameter controlling whether the styles are returned.

Usage

commentTable(doc)
commentTable2(doc)
commentNodes(doc)
comments(doc, op = xmlValue)

Arguments

doc

the Office Open document

op

a function that is used to process each of the comment nodes, e.g. xmlValue

Value

comments returns a character vector giving the contents of the comments.

commentTable returns a data frame with as many rows as there are comments. The data frame has 4 variables:

id

the identifier for the author

author

the name of the author

date

the date the comment was changed and of class POSIXct.

value

the text content of the comment

commentNodes returns a list of XMLInternalElementNode objects.

See Also

wordDoc

Examples

  
     file = system.file("SampleDocs", "WordEg.docx", package = "ROOXML")
if(require(RWordXML)) {
     doc = wordDoc(file)
     comments(doc)

     commentTable(doc)

     commentNodes(doc)
}
        

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