I don't know what the error is, but your code snippet worked fine for me on Windows 10, R 3.4.0-patched.

I noticed that rJava is a dependency. Don't know that the patch or Java updates I installed today could be a difference, but you might update packages, patched version, Java, etc and try again [since it worked here pasted right from your example].


On 5/14/2017 2:30 PM, Yves S. Garret wrote:
I'm using R 3.4.0.

---------- Forwarded message ----------
From: Yves S. Garret <yoursurrogate...@gmail.com>
Date: Sun, May 14, 2017 at 2:35 PM
Subject: Cannot generate a *.docx file
To: r-help <r-help@r-project.org>


Hello,

I have the following code example:

library(ReporteRs)

# Create a word document to contain R outputs
doc <- docx()

# Add a title to the document
doc <- addTitle(doc, "Simple Word document", level = 1)

# Add a paragraph of text into the Word document
cat("Output 1\n")
doc <- addParagraph(doc, "This.")
cat("Output 2\n")

# Write the Word document to a file
writeDoc(doc, file = "r-reporters-simple-word-document.docx")

When I run it, this is what I see:

source("writing_to_ms_word_new.R")
Output 1
Error in UseMethod("addParagraph") :
   no applicable method for 'addParagraph' applied to an object of class
"docx"

Why?  The library loads as it should.  So why am I getting the above error?

Thanks in advance.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to