簡體   English   中英

如何在 Shiny UI 中動態顯示本地 html 文件?

[英]How can I display a local html file in Shiny UI dynamically?

另一個腳本在本地目錄中創建了一個 example.html。 在那之前,Shiny UI 應該顯示一個空屏幕,當 example.html 生成時,它應該反映在 Shiny UI 中。

example.html 已加載到 Shiny UI 中,但未得到反映。

這是我試過的代碼,至少用於顯示文件

代碼:

ui = shinyUI(fluidPage(titlePanel("Generated Report"),
                       mainPanel(htmlOutput("showfile"))
                       )
             )

server = function(input, output, session){
  output$showfile <- renderUI({
    includeHTML("C://Users//DELL//Desktop//abc_files//www//report.html")
    # HTML(readLines(file_to_show))
  })

}

shinyApp(ui, server)

如果您想在閃亮的應用程序中顯示 ...report.html 文件,則文件路徑中的//不正確。

此腳本(帶有單個/ )將顯示 HTML 文件。

ui = shinyUI(fluidPage(titlePanel("Generated Report"),
                   mainPanel(htmlOutput("showfile"))
                   )
         )

server = function(input, output, session){
  output$showfile <- renderUI({
    includeHTML("C:/Users/DELL/Desktop/abc_files/www/report.html")
    # HTML(readLines(file_to_show))
  })

}

shinyApp(ui, server)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM