Closed pgseye closed 9 months ago
r2rtf define the border width as a scalar value that control all border width.
Would suggest to use different line type that can be controlled in each cell.
https://merck.github.io/r2rtf/articles/rtf-row.html#border-type
Alternatively, you can write a post-hoc function to modify the source code generated by "rtf_encode" to achieve the goal.
Thank you but I can't see how to amend specific cells from that. I keep getting errors relating to incorrect number of dimensions when I try to specify cells. Say you have:
> matrix(r2rtf:::border_type()$name[1], nrow = 7, ncol = 3, byrow = TRUE)
[,1] [,2] [,3]
[1,] "" "" ""
[2,] "" "" ""
[3,] "" "" ""
[4,] "" "" ""
[5,] "" "" ""
[6,] "" "" ""
[7,] "" "" ""
How would I amend this to include a single border at the 4th row, leaving all other borders blank?
Simply define a matrix as argument input that has the same dimension of your input data.
library(r2rtf)
head(iris) %>%
rtf_body(
border_top = matrix(c("", "", "", "single", "", ""), ncol = 5, nrow = 6)
) %>%
rtf_encode() %>%
write_rtf("tmp.rtf")
Thank you
I am wondering if it's possible to set different border widths in a section? For example, I am noticing that if I have a top and bottom border for a col_header, I don't necessarily want the bottom border to be the same thickness as the top border (see screenshot), I would like to make it thinner. Is this possible? example code:
If I then add:
to rtf_colheader and change the border width to 5, the top colheader border thins instead.