R officer package generates PPTX file with content not redable by Power Point

Hi, I am using below code to generate a simple PPTX file using Officer Package:

if(!require("officer")) install.packages("officer")
library(officer)

doc = read_pptx()

doc = add_slide(doc, "Title Only", master="Office Theme")
doc <- ph_with_text(x = doc, type = "title", str = "Example title")

## write the document 
	print(doc, "C:/PPT_Test.pptx" )

This code is generating PPTX file in C drive. but when I am opening this file I am getting below message:
PPT found a problem with content in C:\PPT_Test.PPTX. Powerpoint can attempt to repair the presentation.
Once I click on Repair, it shown another message:
PowerPoint couldnot read some content and removed it. Once I click OK, it open the ppt file.
How can I get rid of this message.
When I was creating PPTX file from Reporters package, I was not getting any such message and PPTX file was opening without any issue.

Thanks
Rajneesh

Try with the new ph_with() function, I get no warning message with this code

Note that ph_with is new and should replace ph_with_* and ph_with_*_at .

library(officer)
library(magrittr)

read_pptx() %>% 
  add_slide("Title Only", master="Office Theme") %>% 
  ph_with(value = "Example title", location = ph_location_type(type = "title")) %>% 
  print("PPT_Test.pptx" )

Hi Andresrcs,
Thanks for your help. I tried your suggestion, but getting same message while opening PPTX file.
I noticed that the PPTX file generated is in read only mode. When I save this file again in some other location or same location with different name, I am not getting this message while opening the file.
So do we have any option to save the file not in Read only mode.
Please correct me if I am in wrong direction.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.