davidgohel / officer

:cop: officer: office documents from R
https://ardata-fr.github.io/officeverse/
Other
606 stars 107 forks source link

Error opening Word doc #188

Closed mpainter99 closed 5 years ago

mpainter99 commented 5 years ago

When I create a new docx using the Quick Start example Word throws an error.

my_doc <- read_docx() 

src <- tempfile(fileext = ".png")
png(filename = src, width = 5, height = 6, units = 'in', res = 300)
barplot(1:10, col = 1:10)
dev.off()

my_doc <- my_doc %>% 
  body_add_img(src = src, width = 5, height = 6, style = "centered") %>% 
  body_add_par("Hello world!", style = "Normal") %>% 
  body_add_par("", style = "Normal") %>% # blank paragraph
  body_add_table(iris, style = "table_template")

print(my_doc, target = "first_example.docx")

Results in the following when I try and open the file. image

Selecting OK results in the following message: image

I am currently using Microsoft Word for Office 365 MSO(16.0.10730.20264) 32-bit.

summaryInfo() produces the following: R version 3.5.2 (2018-12-20) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] dplyr_0.8.0.1 officer_0.3.2

loaded via a namespace (and not attached): [1] zip_2.0.0 Rcpp_1.0.0 pillar_1.3.1 compiler_3.5.2 prettyunits_1.0.2 base64enc_0.1-3 remotes_2.0.2
[8] tools_3.5.2 testthat_2.0.1 digest_0.6.18 pkgbuild_1.0.2 uuid_0.1-2 pkgload_1.0.2 memoise_1.1.0
[15] tibble_2.0.1 pkgconfig_2.0.2 rlang_0.3.1 cli_1.0.1 rstudioapi_0.9.0 curl_3.3 yaml_2.2.0
[22] withr_2.1.2 xml2_1.2.0 fs_1.2.6 desc_1.2.0 devtools_2.0.1 rprojroot_1.3-2 tidyselect_0.2.5 [29] glue_1.3.0 R6_2.4.0 processx_3.2.1 sessioninfo_1.1.1 purrr_0.3.0 callr_3.1.1 magrittr_1.5
[36] usethis_1.4.0 backports_1.1.3 ps_1.3.0 htmltools_0.3.6 assertthat_0.2.0 crayon_1.3.4

davidgohel commented 5 years ago

Hi

This happened because of an update of r-libs/zip. The github version of officer already contain a fix - I am planning to submit a new release on cran soon, probably this week.

aravind-j commented 5 years ago

My package augmentedRCBD with officer as a dependency was showing the following warning in R CMD check due to the same reason.

prepare_Rd: replacing previous import ‘zip::unzip’ by ‘utils::unzip’ when loading ‘officer’ 

It disappeared with the updated version of officer from github.

davidgohel commented 5 years ago

(thanks @aravind-j for the feedback)

The new release has just been accepted on CRAN. The binaries should appear in the following days.

candronikos commented 5 years ago

@davidgohel I'm getting the same problem using the github and CRAN version except I only get the prompt from the second image.

davidgohel commented 5 years ago

@candronikos please open a new issue - do not comment on old closed issues

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.