File: setRowHeights.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 (73 lines) | stat: -rw-r--r-- 1,773 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wrappers.R
\name{setRowHeights}
\alias{setRowHeights}
\title{Set worksheet row heights}
\usage{
setRowHeights(
  wb,
  sheet,
  rows,
  heights,
  fontsize = NULL,
  factor = 1,
  base_height = 15,
  extra_height = 12,
  wrap = TRUE
)
}
\arguments{
\item{wb}{workbook object}

\item{sheet}{name or index of a worksheet}

\item{rows}{indices of rows to set height}

\item{heights}{heights to set rows to specified in Excel column height units}

\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}

\item{wrap}{wrap text of entries which exceed the column width, optional}
}
\description{
Set worksheet row heights
}
\examples{
## Create a new workbook
wb <- createWorkbook()

## Add a worksheet
addWorksheet(wb, "Sheet")
sheet <- 1

## Write dummy data
writeData(wb, sheet, "fixed w/fixed h", startCol = 1, startRow = 1)
writeData(wb, sheet, "fixed w/auto h ABC ABC ABC ABC ABC ABC ABC ABC ABC ABC ABC",
 startCol = 2, startRow = 2)
writeData(wb, sheet, "variable w/fixed h", startCol = 3, startRow = 3)

## Set column widths and row heights
setColWidths(wb, sheet, cols = c(1, 2, 3, 4), widths = c(10, 20, "auto", 20))
setRowHeights(wb, sheet, rows = c(1, 2, 8, 4, 6), heights = c(30, "auto", 15, 15, 30))

## Overwrite row 1 height
setRowHeights(wb, sheet, rows = 1, heights = 40)

## Save workbook
\dontrun{
saveWorkbook(wb, "setRowHeightsExample.xlsx", overwrite = TRUE)
}
}
\seealso{
\code{\link[=removeRowHeights]{removeRowHeights()}}
}
\author{
Alexander Walker
}