Hello,
thank you for this very useful package.
After updating R and all packages recently, I found that reports I used to create successfully with markdown and officer create corrupted docx files (both with the CRAN and GitHub version of officer). Word reports the content is causing problems but does not offer to recover the content of the file:

It seems the issue is related to block_caption() used in the markdown:
fig_num <- run_autonum(seq_id = "Figure", pre_label = "Figure ", bkm = "fig1")
block_caption("Test caption",
style = "Normal",
autonum = fig_num)
This worked flawlessly in officer 0.5.2 (from R 4.2.1), but corrupts the docx in the CRAN version and GitHub versions of officer (from R 4.3.1 - see sessionInfo below).
Attached is a zip file containing the R markdown file, the correct docx output file from officer 0.5.2 and the corrupted docx from officer_0.6.3.002.
Is the usage of block_caption() in a markdown correct, or am I doing something wrong here? Just wondering since it worked in previous versions. I guess I can achieve the same look with fpar(), but the convenience of block_caption is great.
sessionInfo() for the correct docx file:
> sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] officer_0.5.2 officedown_0.3.0
loaded via a namespace (and not attached):
[1] sf_1.0-9 lubridate_1.9.2 fontquiver_0.2.1 RColorBrewer_1.1-3 tools_4.2.1 backports_1.4.1
[7] utf8_1.2.3 R6_2.5.1 rpart_4.1.16 KernSmooth_2.23-20 Hmisc_4.8-0 DBI_1.1.3
[13] colorspace_2.1-0 nnet_7.3-17 tidyselect_1.2.0 gridExtra_2.3 curl_5.0.0 compiler_4.2.1
[19] cli_3.4.1 htmlTable_2.4.1 xml2_1.3.3 fontBitstreamVera_0.1.1 scales_1.2.1 checkmate_2.1.0
[25] classInt_0.4-8 proxy_0.4-27 askpass_1.1 systemfonts_1.0.4 stringr_1.5.0 digest_0.6.31
[31] foreign_0.8-82 rmarkdown_2.21 gfonts_0.2.0 base64enc_0.1-3 jpeg_0.1-10 pkgconfig_2.0.3
[37] htmltools_0.5.4 fastmap_1.1.1 rvg_0.3.2 htmlwidgets_1.6.1 rlang_1.0.6 readxl_1.4.2
[43] rstudioapi_0.14 httpcode_0.3.0 shiny_1.7.4 generics_0.1.3 jsonlite_1.8.4 dplyr_1.1.0
[49] zip_2.2.2 magrittr_2.0.3 Formula_1.2-5 interp_1.1-3 Matrix_1.5-3 Rcpp_1.0.10
[55] munsell_0.5.0 fansi_1.0.4 gdtools_0.3.1 lifecycle_1.0.3 terra_1.7-3 stringi_1.7.12
[61] yaml_2.3.7 plyr_1.8.8 grid_4.2.1 promises_1.2.0.1 crayon_1.5.2 deldir_1.0-6
[67] lattice_0.20-45 splines_4.2.1 knitr_1.42 pillar_1.8.1 uuid_1.1-0 reshape2_1.4.4
[73] codetools_0.2-18 crul_1.3 glue_1.6.2 evaluate_0.20 fontLiberation_0.1.0 latticeExtra_0.6-30
[79] data.table_1.14.8 png_0.1-8 vctrs_0.5.2 httpuv_1.6.9 cellranger_1.1.0 gtable_0.3.1
[85] openssl_2.0.5 cachem_1.0.7 ggplot2_3.4.1 xfun_0.39 mime_0.12 xtable_1.8-4
[91] e1071_1.7-13 later_1.3.0 class_7.3-20 survival_3.3-1 tibble_3.1.8 memoise_2.0.1
[97] units_0.8-1 cluster_2.1.3 timechange_0.2.0 ellipsis_0.3.2
sessionInfo for the corrupted docx:
> sessionInfo()
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] officer_0.6.3.002 officedown_0.3.0
loaded via a namespace (and not attached):
[1] jsonlite_1.8.7 compiler_4.3.1 crayon_1.5.2 promises_1.2.0.1 Rcpp_1.0.11 zip_2.3.0
[7] xml2_1.3.5 later_1.3.1 fontquiver_0.2.1 systemfonts_1.0.4 textshaping_0.3.6 uuid_1.1-0
[13] yaml_2.3.7 fastmap_1.1.1 mime_0.12 R6_2.5.1 gfonts_0.2.0 gdtools_0.3.3
[19] curl_5.0.1 knitr_1.43 openssl_2.0.6 crul_1.4.0 shiny_1.7.4.1 rlang_1.1.1
[25] rvg_0.3.3 cachem_1.0.8 httpcode_0.3.0 httpuv_1.6.11 xfun_0.39 memoise_2.0.1
[31] cli_3.6.1 magrittr_2.0.3 digest_0.6.33 xtable_1.8-4 rstudioapi_0.15.0 askpass_1.1
[37] lifecycle_1.0.3 evaluate_0.21 glue_1.6.2 fontLiberation_0.1.0 ragg_1.2.5 fontBitstreamVera_0.1.1
[43] rmarkdown_2.23 ellipsis_0.3.2 tools_4.3.1 htmltools_0.5.5
P.S.1.: I wanted to try this with officer 0.5.2 in R 4.3.1, but after installing officer 0.5.2 got the error:
>library(officedown) # using 0.3.0
Error: package or namespace load failed for ‘officedown’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘officer’ 0.5.2 is already loaded, but >= 0.6.2 is required
This is a little confusing since according to CRAN officedown imports officer (≥ 0.5.1). R 4.2.1 did not throw that error.
P.S.2: there are typos in autonum here:
https://github.com/davidgohel/officer/blob/c0e15dc488c33268cdb8a8ef633ecd20f2370db2/R/ooxml_block_objects.R#L41
officer_problem.zip
Hello,
thank you for this very useful package.
After updating R and all packages recently, I found that reports I used to create successfully with markdown and officer create corrupted docx files (both with the CRAN and GitHub version of officer). Word reports the content is causing problems but does not offer to recover the content of the file:
It seems the issue is related to block_caption() used in the markdown:
This worked flawlessly in officer 0.5.2 (from R 4.2.1), but corrupts the docx in the CRAN version and GitHub versions of officer (from R 4.3.1 - see sessionInfo below).
Attached is a zip file containing the R markdown file, the correct docx output file from officer 0.5.2 and the corrupted docx from officer_0.6.3.002.
Is the usage of block_caption() in a markdown correct, or am I doing something wrong here? Just wondering since it worked in previous versions. I guess I can achieve the same look with fpar(), but the convenience of block_caption is great.
sessionInfo() for the correct docx file:
sessionInfo for the corrupted docx:
P.S.1.: I wanted to try this with officer 0.5.2 in R 4.3.1, but after installing officer 0.5.2 got the error:
This is a little confusing since according to CRAN officedown imports officer (≥ 0.5.1). R 4.2.1 did not throw that error.
P.S.2: there are typos in autonum here:
https://github.com/davidgohel/officer/blob/c0e15dc488c33268cdb8a8ef633ecd20f2370db2/R/ooxml_block_objects.R#L41
officer_problem.zip