【问题标题】:How to fix row width of the read xlsm file in shiny?如何修复闪亮的读取 xlsm 文件的行宽?
【发布时间】:2019-08-04 01:17:22
【问题描述】:

我们如何固定每一行的宽度。 以下是重现错误的示例代码和示例数据文件 (sample data):

library(shiny)
library(readxl)

runApp(
  list(
    ui = fluidPage(
      titlePanel("Use readxl"),
      sidebarLayout(
        sidebarPanel(
          fileInput('file1', 'Choose xlsx file',
                    accept = c(".xlsx")
          )
        ),
        mainPanel(
          tableOutput('contents'))
      )
    ),
    server = function(input, output){
      output$contents <- renderTable({

        req(input$file1)

        inFile <- input$file1

        readxl::read_excel(inFile$datapath, 1)
      })
    }
  )
)

正如我们所观察到的,第一行和第二行的宽度不同。是否有可能使用“DT”来固定行宽? Row width of read xlsm

【问题讨论】:

    标签: r shiny dt


    【解决方案1】:

    如果您在 R 控制台中输入 ?renderTable(或在 shiny website 上查找),您将看到一个帮助页面。除了其他对您有用的东西外,它还有一个间距变量,您可以在调用renderTable() 时使用它。尝试将其设置为大,例如

    output$contents <- renderTable({
      iris 
    }, spacing = 'l')
    

    如果它不适合你,请告诉我

    【讨论】:

    • 感谢您的建议。我尝试如下:``` server = function(input, output){ output$contents
    猜你喜欢
    • 2018-07-02
    • 1970-01-01
    • 1970-01-01
    • 2021-01-03
    • 1970-01-01
    • 2021-05-16
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    相关资源
    最近更新 更多