Skip to content

Commit

Permalink
Another attempt to pass checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dbosak01 committed Oct 27, 2023
1 parent 39dc970 commit 3ee18b0
Show file tree
Hide file tree
Showing 7 changed files with 2,229 additions and 2,194 deletions.
7 changes: 7 additions & 0 deletions R/page_template_docx.R
Original file line number Diff line number Diff line change
Expand Up @@ -1360,8 +1360,15 @@ get_page_by_docx <- function(pgby, width, value, rs, talgn,

}


pdf(NULL)
par(family = get_font_family(rs$font), ps = rs$font_size)

# Account for multiple pgby lines
tmp <- split_string_html(value, width, rs$units)

dev.off()

vl <- tmp$html
cnt <- cnt + tmp$lines
vrht <- get_row_height(round(rs$row_height * conv) * tmp$lines)
Expand Down
7 changes: 7 additions & 0 deletions R/page_template_html.R
Original file line number Diff line number Diff line change
Expand Up @@ -1143,8 +1143,15 @@ get_page_by_html <- function(pgby, width, value, rs, talgn, ex_brdr = FALSE, pgb
exclude = exclude_top,
border_color = get_style(rs, "border_color"))


pdf(NULL)
par(family = get_font_family(rs$font), ps = rs$font_size)

# Account for multiple pgby lines
tmp <- split_string_html(value, width, rs$units)

dev.off()

vl <- tmp$html
cnt <- cnt + tmp$lines

Expand Down
5 changes: 5 additions & 0 deletions R/page_template_rtf.R
Original file line number Diff line number Diff line change
Expand Up @@ -1112,11 +1112,16 @@ get_page_by_rtf <- function(pgby, width, value, rs, talgn, pgby_cnt = NULL) {

tb <- get_cell_borders(brow, 1 , trows, 1, pgby$borders)

pdf(NULL)
par(family = get_font_family(rs$font), ps = rs$font_size)

# Account for multiple pgby lines
tmp <- split_string_rtf(value, width, rs$units)
vl <- tmp$rtf
cnt <- cnt + tmp$lines

dev.off()

# Construct RTF for pageby value
ret[length(ret) + 1] <- paste0("\\trowd\\trgaph0", ta, tb,
"\\cellx", w1, algn, " ",
Expand Down
13 changes: 11 additions & 2 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,17 @@ split_strings <- function(strng, width, units, multiplier = 1.03) {

wrds <- strsplit(split, " ", fixed = TRUE)[[1]]

lngths <- (suppressWarnings(strwidth(wrds, units = un)) +
suppressWarnings(strwidth(" ", units = un))) * multiplier
lngths <- c()
# trycatch({
lngths <- (suppressWarnings(strwidth(wrds, units = un)) +
suppressWarnings(strwidth(" ", units = un))) * multiplier

# }, err = {
#
# lngths <- (suppressWarnings(strwidth(wrds, units = un)) +
# suppressWarnings(strwidth(" ", units = un))) * multiplier
#
# })

# Loop through words and add up lines
for (i in seq_along(wrds)) {
Expand Down
Binary file removed tests/testthat/Rplots.pdf
Binary file not shown.
Loading

0 comments on commit 3ee18b0

Please sign in to comment.