R/toc.options.R

Defines functions toc.options toc.options.docx

Documented in toc.options toc.options.docx

#' @title Set TOC options
#'
#' @description Set custom table of contents options for a document object
#'
#' @param doc Object of class \code{docx}
#' @param ... further arguments passed to other methods
#' @return a document object
#' @export
#' @seealso \code{\link{docx}}, \code{\link{addTOC.docx}}
toc.options <- function(doc, ...){
  UseMethod("toc.options")
}

#' @param list.separator list separator (should be the same than in computer's regional settings)
#' @details
#' This function is to be used if TOC cannot be built. It is
#' occuring when list separator used when building the TOC is
#' different from the list separator in your computer's regional settings.
#'
#' See entry 302865 of Microsoft knowledge database for more information.
#'
#' @examples
#' \donttest{
#' doc = docx( title = "title" )
#' doc = toc.options( doc, list.separator = "," )
#' }
#' @seealso \code{\link{docx}}, \code{\link{addTOC.docx}}
#' @export
#' @rdname toc.options
toc.options.docx = function( doc, list.separator, ... ){

	if( missing( list.separator ) )
		stop("list.separator is missing")
	if( length( list.separator ) != 1 )
		stop("length of list.separator must be 1")
	if( nchar( list.separator ) != 1 )
		stop("number of character of list.separator must be 1 (',' or ';'")
	.jcall( doc$obj, "V", "setListSeparator", list.separator )
	doc
}

Try the ReporteRs package in your browser

Any scripts or data that you put into this service are public.

ReporteRs documentation built on April 1, 2018, 12:06 p.m.