1
나는 Rstudio에서 This example을 재현하려고 시도했다. 잘 작동하고있다. 그런 다음 템플릿을 모두 다운로드하여 반짝 반짝 빛납니다. 하지만이 작동하지 않습니다빛나는에서 docx 보고서를 다운로드하는 리포터 패키지
library(shiny)
library(ReporteRs)
library(ReporteRsjars)
library(ggplot2)
library(magrittr)
library(ggplot2)
library(magrittr)
ui<- fluidPage(
downloadButton('downloadData', 'Download')
)
server<- function(input, output,session) {
output$downloadData <- downloadHandler(
filename = "file.docx",
content = function(file) {
target_file <- "bookmark_example.docx" # file to produce
template <- system.file(package = "ReporteRs",
"templates/bookmark_example.docx") # template example
doc = docx(template=template)
ft <- vanilla.table(data = head(iris), add.rownames=TRUE)
myplot1 <- ggplot(data = iris, aes(Sepal.Length, Petal.Length, color = Species),
alpha = I(0.7))
doc %>%
addParagraph(value = "Jane Doe", stylename = "small", bookmark = "AUTHOR") %>%
addParagraph(value = "John Doe", stylename = "small", bookmark = "REVIEWER") %>%
addFlexTable(flextable = ft, bookmark = "DATA") %>%
addPlot(fun = print, x = myplot1, bookmark = "PLOT") %>%
writeDoc(file = target_file)
}
)
}
shinyApp(ui=ui,server=server)
을 나는 반짝에 넣지 않고, 서버의 컨텐츠를 실행하면, 내가 다운로드 버튼을 클릭하면 그것은하지만 반짝 내 템플릿을 업데이트, 그것은 반환
어떤 생각이 실수입니까?
기자 패키지별로 docx 파일에 리플렛 맵을 추가하는 방법을 알고 계십니까? –
.docx는 HTML을 지원하지 않습니다. 이것은 완전히 사실이 아니지만 형식화 된 테이블보다 더 정교한 것으로 생각하는 것이 가장 좋습니다. 그래서 .docx 안에는 전단지 지원이 없습니다. 자유를 원한다면 rMarkdown으로 전환하십시오. – Christian