Learn R Programming

openxlsx2 (version 1.7)

properties-wb: Modify workbook properties

Description

This function is useful for workbooks that are loaded. It can be used to set the workbook title, subject and category field. Use wb_workbook() to easily set these properties with a new workbook.

Usage

wb_get_properties(wb)

wb_set_properties( wb, creator = NULL, title = NULL, subject = NULL, category = NULL, datetime_created = Sys.time(), modifier = NULL, keywords = NULL, comments = NULL, manager = NULL, company = NULL, custom = NULL )

Value

A wbWorkbook object, invisibly.

Arguments

wb

A Workbook object

creator

Creator of the workbook (your name). Defaults to login username or options("openxlsx2.creator") if set.

title, subject, category, keywords, comments, manager, company

Workbook property, a string.

datetime_created

The time of the workbook is created

modifier

A character string indicating who was the last person to modify the workbook

custom

A named vector of custom properties added to the workbook

Details

To set properties, the following XML core properties are used.

  • title = dc:title

  • subject = dc:subject

  • creator = dc:creator

  • keywords = cp:keywords

  • comments = dc:description

  • modifier = cp:lastModifiedBy

  • datetime_created = dcterms:created

  • datetime_modified = dcterms:modified

  • category = cp:category

In addition, manager and company are used.

See Also

wb_workbook()

Examples

Run this code
file <- system.file("extdata", "openxlsx2_example.xlsx", package = "openxlsx2")
wb <- wb_load(file)
wb$get_properties()

# Add a title to properties
wb$set_properties(title = "my title")
wb$get_properties()

Run the code above in your browser using DataLab