% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/config_utils.R
\name{create_config_yaml}
\alias{create_config_yaml}
\title{Create an aftables config.yaml}
\usage{
create_config_yaml(path = getwd(), open_config = rlang::is_interactive())
}
\arguments{
\item{path}{optional character string containing directory to copy the
config.yaml file. Defaults to current working directory.}

\item{open_config}{optional logical whether to open the copy of config.yaml
for editing in the current R session.}
}
\description{
Copy the example config.yaml file included with aftables to a directory of
the user's choice, and optionally open the file for editing. The config.yaml
file can be passed to the aftables function
\code{\link[aftables]{generate_workbook}}.
}
\details{
If there is an existing config.yaml file in the destination
directory this function will not overwrite it.

Contents of example config.yaml:

\if{html}{\out{<div class="sourceCode xml">}}\preformatted{aftables:
  default:
    workbook_properties:
      author: "aftables"
      title: "aftables example workbook"
      keywords:
        - "aftables1"
        - "aftables2"
        - "aftables3"
      subject: "aftables example subject"
      category: "aftables example category"
      comments: "aftables example comments"
    workbook_format:
      base_font_name: "Arial"
      base_font_size: 12
      table_header_size: 12
      sheet_heading_size: 16
      sheet_subheading_size: 14
      cellwidth_default: 16
      cellwidth_wider: 32
      nchar_break: 50
  workbook1:
    workbook_properties:
      category: "aftables workbook 1 category"
      keywords:
        - "aftablesworkbook1"
  workbook2:
    workbook_properties:
      title: "aftables workbook 2"
      category: "aftables workbook 2 category"
      keywords:
        - "aftablesworkbook2"

}\if{html}{\out{</div>}}

All configurations must be placed below an \code{aftables} key. \code{aftables} should
be followed by a \code{default} key and/or custom keys (e.g. \code{workbook1}).

The \code{default} key settings will be read by all calls to
\code{\link[aftables]{generate_workbook}} which use this config.yml. This
allows you to share settings when generating multiple workbooks in one
script.

Custom key settings (e.g. \code{workbook1}) will only be used by
\code{\link[aftables]{generate_workbook}} when the key is provided as the
\code{config_name} argument. This allows you to specify settings for a specific
workbook. Custom key settings will be preferred over the \code{default} settings.

Keys below workbook_properties will appear in the Excel workbook when it is
saved using \code{\link[openxlsx2]{wb_save}} from openxlsx2. They can be
found in the file properties or the workbook information.

Keys below \code{workbook_format} will be applied to the contents of the workbook.
The values of \code{base_font_name} and \code{base_font_size} define the default font
name and size used by the workbook. All text not formatted as a table header,
sheet subheading or sheet heading will use the default settings. Font sizes
of sheet headings, sheet subheadings, and table header rows will use the
values of \code{sheet_heading_size}, \code{sheet_subheading_size} and
\code{table_header_size} respectively, and they will additionally be formatted as
bold.

The values of \code{cellwidth_default}, \code{cellwidth_wider} and \code{nchar_break} are
used to define column widths. The units of \code{cellwidth_default} and
\code{cellwidth_wider} are the column width values used by Excel. All columns
widths are set by default to use the \code{cellwidth_default} value. If the number
of characters in a column header or the contents of a column exceeds the
value of \code{nchar_break} aftables will set the column width to the value of
\code{cellwidth_wider}. Users can avoid text wrapping in columns or column headers
by setting the value of \code{nchar_break} based on their data or the content of
their column headers.

Not all workbook configuration options need to be set. Required settings are
documented in \code{\link[aftables]{generate_workbook}}.
}
\examples{
# Use default arguments to copy `aftables` `config.yaml` file to the current
# working directory without opening the copied file for editing:

\dontrun{
create_config_yaml(open_config = FALSE)}

}
