Skip to content

Commit

Permalink
Enable the use of officedown to allow more customization of Word docu…
Browse files Browse the repository at this point in the history
…ments
  • Loading branch information
PaulRegular committed Jun 6, 2024
1 parent f55d6d1 commit a30d64e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Encoding: UTF-8
LazyData: true
Imports:
bookdown,
officedown,
knitr,
rmarkdown,
ggplot2,
Expand All @@ -34,7 +35,7 @@ Imports:
sysfonts,
showtext
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
RoxygenNote: 7.2.3
VignetteBuilder: knitr
URL: https://github.com/nafc-assess/NAFOdown
BugReports: https://github.com/nafc-assess/NAFOdown/issues
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ export(plot_lengths)
export(theme_nafo)
export(theme_nafotabs)
export(word_scr)
export(word_scr2)
export(word_scs)
export(word_scs2)
export(word_stacfis)
export(word_stacfis2)
import(bookdown)
import(flextable)
import(ggplot2)
import(ggridges)
import(ggthemes)
import(officedown)
import(showtext)
importFrom(magrittr,"%>%")
importFrom(officer,fp_border)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
- Adapted csasdown for NAFO documents
- Added a ggplot and flextable themes for producing plots and tables that comply with NAFO plotting guidelines
- Added a function for producing ridge plots from annual length frequency data
- Enable the use of bookdown::word_document2 or officedown::rdocx_document to build Word documents (see ?word_scr)
22 changes: 17 additions & 5 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,37 @@
#'
#' This is a function called in output in the YAML of the driver Rmd file
#' to specify the creation of a Microsoft Word version of an SCR, STACFIC
#' or SCS report.
#' or SCS report. Functions with 2 as a suffix are built using
#' [officedown::rdocx_document()], allowing users to leverage more in depth
#' customization of Word output.
#'
#' @param ... arguments to pass to [bookdown::word_document2()]
#' @param ... arguments to pass to [bookdown::word_document2()] or [officedown::rdocx_document()]
#' for functions with 2 as a suffix.
#'
#' @return A Word Document based on the NAFO SCR, STACFIC or SCS word template.
#'
#' @import bookdown
#' @import officedown
#' @rdname word_scr
#' @export
#'
word_scr <- .make_word_function(bookdown::word_document2, "SCR_template.docx")

#' @rdname word_scr
#' @export
#'
word_scr2 <- .make_word_function(officedown::rdocx_document, "SCR_template.docx")

#' @rdname word_scr
#' @export
word_stacfis <- .make_word_function(bookdown::word_document2, "STACFIS_template.docx")

#' @rdname word_scr
#' @export
#'
word_stacfis2 <- .make_word_function(officedown::rdocx_document, "STACFIS_template.docx")

#' @rdname word_scr
#' @export
word_scs <- .make_word_function(bookdown::word_document2, "SCS_template.docx")

#' @rdname word_scr
#' @export
word_scs2 <- .make_word_function(officedown::rdocx_document, "SCS_template.docx")
16 changes: 14 additions & 2 deletions man/word_scr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a30d64e

Please sign in to comment.