Skip to content

Commit 626f18f

Browse files
committed
feat: add unit (in, cm, mm) argument in function page_size()
fix #579
1 parent 96d5196 commit 626f18f

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: officer
33
Title: Manipulation of Microsoft Word and PowerPoint Documents
4-
Version: 0.6.7.003
4+
Version: 0.6.7.004
55
Authors@R: c(
66
person("David", "Gohel", , "[email protected]", role = c("aut", "cre")),
77
person("Stefan", "Moog", , "[email protected]", role = "aut"),

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
- new convenience functions `body_replace_gg_at_bkm()` and `body_replace_plot_at_bkm()`
1111
to replace text content enclosed in a bookmark with a ggplot or a base plot.
12-
12+
- add `unit` (in, cm, mm) argument in function `page_size()`.
1313

1414
# officer 0.6.6
1515

R/ooxml_run_objects.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,15 @@ inch_to_tweep <- function(x) round(x * 72 * 20, digits = 0)
643643
#' in landscape mode then the length becomes the width and the width becomes the length.
644644
#' @param width,height page width, page height (in inches).
645645
#' @param orient page orientation, either 'landscape', either 'portrait'.
646+
#' @param unit unit for width and height, one of "in", "cm", "mm".
646647
#' @examples
647648
#' page_size(orient = "landscape")
648649
#' @family functions for section definition
649-
page_size <- function(width = 21 / 2.54, height = 29.7 / 2.54, orient = "portrait") {
650+
page_size <- function(width = 21 / 2.54, height = 29.7 / 2.54, orient = "portrait", unit = "in") {
651+
652+
width <- convin(unit = unit, x = width)
653+
height <- convin(unit = unit, x = height)
654+
650655
if (orient %in% "portrait") {
651656
h <- max(c(height, width))
652657
w <- min(c(height, width))

man/page_size.Rd

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)