简体   繁体   中英

flextable Header Border with border.right argument

I am trying to put vertical borders on both sides of the header and am able to get a border for the left side but not the right side.

library(officer)
library(flextable)
library(dplyr)
bigborder <- fp_border(style = "solid", width=2)
flextable(head(iris)) %>%
  add_header_row(top = TRUE, values = c("12", "3", "45"), colwidths = c(2,1, 2)) %>%
  add_header_row(top = TRUE, values = c("123", "45"), colwidths = c(3, 2)) %>%
  border(border.left = bigborder, j = 1, part = "all") %>%
  border(border.right= bigborder, j = 5, part = "all")

Here is an example or setting vertical borders on the header part:

library(officer)
library(flextable)
library(magrittr)
bigborder <- fp_border(style = "solid", width=2)
thinborder <- fp_border(color="gray", width=.5)
flextable(head(iris)) %>% 
  add_header_row(top = TRUE, values = c("12", "3", "45"), colwidths = c(2,1, 2)) %>%
  add_header_row(top = TRUE, values = c("123", "45"), colwidths = c(3, 2)) %>%
  border_remove() %>% 
  vline(border = thinborder, part = "header") %>%
  vline_left(border = bigborder, part = "header") %>%
  vline_right(border = bigborder, part = "header") %>% 
  align(align = "center", part = "header") %>% 
  fix_border_issues()

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM