diff --git a/R/mpf_exporters.R b/R/mpf_exporters.R index 873787f4..ec9da77a 100644 --- a/R/mpf_exporters.R +++ b/R/mpf_exporters.R @@ -276,7 +276,7 @@ mpf_to_rtf <- function(mpf, } rtfpg <- r2rtf::rtf_body(rtfpg, - col_rel_width = colwidths, + col_rel_width = colwidths + 0.5, text_justification = c("l", rep("c", ncol(myfakedf) - 1)), text_format = "", text_font = 9, diff --git a/R/tostring.R b/R/tostring.R index cea31f0e..5b6ba84d 100644 --- a/R/tostring.R +++ b/R/tostring.R @@ -271,7 +271,7 @@ set_default_hsep <- function(hsep_char) { nj <- spans[i, j] j <- if (nj > 1) { js <- seq(j, j + nj - 1) - cell_widths_mat[i, js] <- sum(cell_widths_mat[i, js]) + col_gap * (nj - 1) + cell_widths_mat[i, js] <- sum(cell_widths_mat[i, js]) + col_gap * (nj - 1) + 1 j + nj } else { j + 1 @@ -1166,7 +1166,7 @@ wrap_string_ttype <- function(str, rawspls <- strsplit(str, "[[:space:]](?=[^[:space:]])", perl = TRUE)[[1]] # preserve all but one space nctt <- nchar_ttype(rawspls, fontspec, raw = TRUE) - pts <- which(cumsum(nctt) <= width) + pts <- which(cumsum(nctt) <= width -5) if (length(pts) == length(rawspls)) { ## no splitting needed return(str) } else if (length(pts) == 0) { ## no spaces, all one word, split it and keep going