hughjonesd / huxtable

An R package to create styled tables in multiple output formats, with a friendly, modern interface.
http://hughjonesd.github.io/huxtable
Other
321 stars 28 forks source link

colspan border when exporting to docx #69

Closed raiphilibert closed 6 years ago

raiphilibert commented 6 years ago

I used a colspan to merge some table headers. However, when exporting to word, the right border does not show up.

Reproducible example (see output screenshot below):

library(huxtable)
library(flextable)

ht <- huxtable(mtcars[1:5,2:10])  %>% huxtable(add_colnames = TRUE) %>% set_all_borders(1)
colspan(ht)[2,1] <- 9
ht <- set_align(ht,2,1,'center')
ht <- set_bold(ht,2,1,TRUE)
ht <- ht %>% set_caption(sprintf('Mtcars example')) %>%
  set_font_size(nrow(ht),everywhere,7) %>% set_all_borders(1)

quick_docx(ht)

image

It would also be great if we could export the caption but I think that this is more of an issue with the flextable object than the huxtable.

hughjonesd commented 6 years ago

Thank you for the bug report. MWE:

ht <- huxtable(mtcars[1:5,2:10], add_colnames = TRUE)
colspan(ht)[2,1] <- 9
ht <- ht %>% set_all_borders(1)
quick_docx(ht)

Seems to be to do with how flextable represents borders.

hughjonesd commented 6 years ago

Could you check if current master fixes your problem (and doesn't cause any others)?

raiphilibert commented 6 years ago

Thanks! It's all fixed now (and no other problems that I can see).