1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
library(XML)
#tt = xmlTree("w:wordDocument", namespaces = c(w = "http://schemas.microsoft.com/office/word/2003/wordml"))
tt = xmlTree(namespaces = c(w = "http://schemas.microsoft.com/office/word/2003/wordml"))
tt$addPI("mso-application", "progid='Word.Document'")
tt$addTag("wordDocument", namespace = "w", close = FALSE)
# XXX if we put this first, we don't get the body. Need to then add the body
# as a sibling of the PI.
v = tt$addTag("w:body",
tt$addTag("w:p",
tt$addTag("w:r",
tt$addTag("w:t", "Hello World!"))))
tt$closeTag()
cat(saveXML(tt))
|