Skip to content

Commit

Permalink
allow vectorized title, subline, footnote and source text justificati…
Browse files Browse the repository at this point in the history
…on (#98)
  • Loading branch information
elong0527 committed May 12, 2022
1 parent a013c34 commit badcb67
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions R/content_create.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ as_rtf_title <- function(tbl) {
return(NULL)
}

as_rtf_paragraph(title)
if( length(unique(attr(title, "text_justification"))) > 1 ){
paste0(as_rtf_paragraph(title, combine = FALSE), collapse = "")
}else{
as_rtf_paragraph(title, combine = TRUE)
}
}

#' Create Table Subline RTF Encode
Expand All @@ -226,7 +230,11 @@ as_rtf_subline <- function(tbl) {
return(NULL)
}

as_rtf_paragraph(subline)
if( length(unique(attr(subline, "text_justification"))) > 1 ){
paste0(as_rtf_paragraph(subline, combine = FALSE), collapse = "")
}else{
as_rtf_paragraph(subline, combine = TRUE)
}
}

#' Create Column Header RTF Encode
Expand Down Expand Up @@ -294,7 +302,11 @@ as_rtf_footnote <- function(tbl) {
)
paste(encode, collapse = "\n")
} else {
as_rtf_paragraph(text)
if( length(unique(attr(text, "text_justification"))) > 1 ){
paste0(as_rtf_paragraph(text, combine = FALSE), collapse = "")
}else{
as_rtf_paragraph(text, combine = TRUE)
}
}
}

Expand Down Expand Up @@ -338,7 +350,11 @@ as_rtf_source <- function(tbl) {
)
paste(encode, collapse = "\n")
} else {
as_rtf_paragraph(text)
if( length(unique(attr(text, "text_justification"))) > 1 ){
paste0(as_rtf_paragraph(text, combine = FALSE), collapse = "")
}else{
as_rtf_paragraph(text, combine = TRUE)
}
}
}

Expand Down

0 comments on commit badcb67

Please sign in to comment.