davidgohel / officer

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

Saving pptx files fails if officer is installed read-only #555

Open natashanath opened 4 months ago

natashanath commented 4 months ago

If officer is installed read-only, saving pptx files fails. This is in reference to the issue stated here #549 which fixed for docx but fails for pptx.

library(officer)

my_pres <- read_pptx() 
my_pres <- add_slide(my_pres, layout = "Title and Content", master = "Office Theme")
print(my_pres, target = 'test.pptx')
> print(my_pres, target = 'test.pptx')
Error in write_xml.xml_document(private$doc, file = private$filename) : 
  Error closing file
In addition: Warning messages:
1: In write_xml.xml_document(private$doc, file = private$filename) :
  Permission denie [1501]
2: In write_xml.xml_document(private$doc, file = private$filename) :
  Permission denie [1501]
davidgohel commented 4 months ago

ha, ok

I will try to fix soon

natashanath commented 3 months ago

@davidgohel following up on the issue. Is there anything required from our end that can help?

nviets commented 2 months ago

Encountered the same issue. This one is important to me too. Thank you!

davidgohel commented 2 months ago

I am not able to reproduce.

It works with the github commit that was supposed to fix it:

nix-shell -p R -p '(rPackages.officer.overrideAttrs (_: {src = (fetchTarball "https://github.com/davidgohel/officer/archive/dbb27faa10e6a520092716748992d69271bf3c94.tar.gz");}))' --run 'Rscript -e "library(officer); d <- read_pptx(); d <- add_slide(d); print(d, target = \"~/test.pptx\")"'

It also works with the cran version:

nix-shell -p R -p rPackages.officer --run 'Rscript -e "library(officer); d <- read_pptx(); d <- add_slide(d); print(d, target = \"~/test.pptx\")"'

How can I reproduce your issue?

davidgohel commented 2 months ago

@natashanath @nviets could you provide something that helps me to reproduce?