https://github.com/cran/XML
Raw File
Tip revision: 6ac5aacfa6b8250c6501b2fe1c24fc9f287f02f3 authored by Duncan Temple Lang on 29 April 2011, 00:00:00 UTC
version 3.4-0
Tip revision: 6ac5aac
wordML.R
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))



back to top