File: auto_heights.Rd

package info (click to toggle)
r-cran-openxlsx 4.2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,328 kB
  • sloc: cpp: 1,867; makefile: 2
file content (58 lines) | stat: -rw-r--r-- 1,329 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helperFunctions.R
\name{auto_heights}
\alias{auto_heights}
\title{Compute optimal row heights}
\usage{
auto_heights(
  wb,
  sheet,
  selected,
  fontsize = NULL,
  factor = 1,
  base_height = 15,
  extra_height = 12
)
}
\arguments{
\item{wb}{workbook}

\item{sheet}{worksheet}

\item{selected}{selected rows}

\item{fontsize}{font size, optional (get base font size by default)}

\item{factor}{factor to manually adjust font width, e.g., for bold fonts,
optional}

\item{base_height}{basic row height, optional}

\item{extra_height}{additional row height per new line of text, optional}
}
\value{
list of indices of columns with fixed widths and optimal row heights
}
\description{
Compute optimal row heights for cell with fixed with and
enabled automatic row heights parameter
}
\examples{
## Create new workbook
wb <- createWorkbook()
addWorksheet(wb, "Sheet")
sheet <- 1

## Write dummy data
long_string <- "ABC ABC ABC ABC ABC ABC ABC ABC ABC ABC ABC"
writeData(wb, sheet, c("A", long_string, "CCC"), startCol = 2, startRow = 3)
writeData(wb, sheet, c(4, 5), startCol = 4, startRow = 3)

## Set column widths and get optimal row heights
setColWidths(wb, sheet, c(1,2,3,4), c(10,20,10,20))
auto_heights(wb, sheet, 1:5)

}
\author{
David Breuer
}