huxtable
huxtable copied to clipboard
Duplicated caption when converting to Word
As the output of the example code below, the Word shows duplicated caption for the generated table.
Example
library(huxtable)
jams <- hux( Type = c("Strawberry", "Raspberry", "Plum"), Price = c(1.90, 2.10, 1.80) )
library(dplyr)
jams %>% set_all_padding(4) %>% set_outer_padding(0) %>% set_number_format(2) %>% set_bold(row = c(1), col = everywhere) %>% set_bottom_border(row = 1, col = everywhere) %>% set_width(0.4) %>% set_caption("Pots of jam for sale") -> jams
quick_docx(jams, file = "jams.docx", borders = 0.4, open = interactive() )
Thank you. Can reproduce.
Could you see if it's fixed in master, using remotes::install_github("hughjonesd/huxtable")
?
remotes::install_github("hughjonesd/huxtable")
Sorry, doesn't work
You mean the install command doesn't work? Or the bug is still present?
I mean the bug is still there
From: David Hugh-Jones @.> Date: Saturday, 18 June 2022, 11:04 To: hughjonesd/huxtable @.> Cc: pavelaegorov @.>, Author @.> Subject: Re: [hughjonesd/huxtable] Duplicated caption when converting to Word (Issue #227)
You mean the install command doesn't work? Or the bug is still present?
— Reply to this email directly, view it on GitHubhttps://github.com/hughjonesd/huxtable/issues/227#issuecomment-1159392292, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZV3MJH37SQJOVC7TAW2DNLVPV7IFANCNFSM5ZDLWEZQ. You are receiving this because you authored the thread.Message ID: @.***>
OK. Please could you confirm your flextable package version? Thanks.
packageVersion("huxtable") [1] ‘5.5.0.9000’
From: David Hugh-Jones @.> Date: Saturday, 18 June 2022, 14:13 To: hughjonesd/huxtable @.> Cc: pavelaegorov @.>, Author @.> Subject: Re: [hughjonesd/huxtable] Duplicated caption when converting to Word (Issue #227)
OK. Please could you confirm your flextable package version? Thanks.
— Reply to this email directly, view it on GitHubhttps://github.com/hughjonesd/huxtable/issues/227#issuecomment-1159446269, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZV3MJAMXC4M4YRE5ZX3Z53VPWVN3ANCNFSM5ZDLWEZQ. You are receiving this because you authored the thread.Message ID: @.***>
Right, but what is your flextable package version?
packageVersion("huxtable") [1] ‘5.5.0.9000’ packageVersion("flextable") [1] ‘0.7.2’
From: David Hugh-Jones @.> Date: Saturday, 18 June 2022, 16:19 To: hughjonesd/huxtable @.> Cc: pavelaegorov @.>, Author @.> Subject: Re: [hughjonesd/huxtable] Duplicated caption when converting to Word (Issue #227)
Right, but what is your flextable package version?
— Reply to this email directly, view it on GitHubhttps://github.com/hughjonesd/huxtable/issues/227#issuecomment-1159464117, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZV3MJAULWJJDGALNSOVWQTVPXEHDANCNFSM5ZDLWEZQ. You are receiving this because you authored the thread.Message ID: @.***>
Mm. OK, now I can't reproduce. With current github and flextable 0.7.2, your code just gives me a single caption.
Could I maybe check the officer version?
Lucky you are! Maybe something wrong from my side) By the way, thanks a LOT!! For your package, just calculated some clinical trial results and it was very easy to send tables to word with the huxtable!! Great job
Pavel
packageVersion("huxtable") [1] ‘5.5.0.9000’ packageVersion("flextable") [1] ‘0.7.2’ packageVersion("officer") [1] ‘0.4.3’
From: David Hugh-Jones @.> Date: Saturday, 18 June 2022, 17:40 To: hughjonesd/huxtable @.> Cc: pavelaegorov @.>, Author @.> Subject: Re: [hughjonesd/huxtable] Duplicated caption when converting to Word (Issue #227)
Could I maybe check the officer version?
— Reply to this email directly, view it on GitHubhttps://github.com/hughjonesd/huxtable/issues/227#issuecomment-1159476352, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZV3MJHKSXWUZZPZ5F4OHADVPXNWXANCNFSM5ZDLWEZQ. You are receiving this because you authored the thread.Message ID: @.***>
Glad to hear it!
This is hard to debug, obviously. If you could try debugonce(quick_docx)
and maybe debugonce(huxtable:::as_flextable.huxtable)
and see what is going on, that might give some insight - in particular, do you see multiple calls to set_caption()
? See ?debug
and ?browser
if you're not familiar with using the debugger.
If possible, could you check whether you get the double caption when you evaluate a huxtable with a caption in an rmarkdown Word document?
Closing until I hear anything back. My guess is that this might be due to confusing huxtable::set_caption()
with flextable::set_caption()
.