officer icon indicating copy to clipboard operation
officer copied to clipboard

Saving pptx files fails if officer is installed read-only

Open natashanath opened this issue 11 months ago • 5 comments

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]

natashanath avatar Mar 06 '24 14:03 natashanath

ha, ok

I will try to fix soon

davidgohel avatar Mar 06 '24 14:03 davidgohel

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

natashanath avatar Apr 10 '24 20:04 natashanath

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

nviets avatar Apr 30 '24 18:04 nviets

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 avatar May 05 '24 10:05 davidgohel

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

davidgohel avatar May 13 '24 19:05 davidgohel