【问题标题】:Custom file name while downloading下载时自定义文件名
【发布时间】:2020-06-22 13:56:35
【问题描述】:

有没有办法下载带有自定义文件名的excel。下面使用默认的 excel 名称下载。我们可以定制吗?比如“df.xlsx”

DT::datatable(df,
                    escape = FALSE, rownames = FALSE,selection = 'single',
                    extensions = c('Buttons'),
                    options = list(
                      scrollX = TRUE,
                      paging = TRUE,
                      buttons = c('excel'),
                      columnDefs = list(list(visible=FALSE, targets=c(2))),                                     
                      pageLength = 400, sScrollY = '40vh',
                      autoWidth = FALSE,
                      buttons = list('copy', 'print',
                                     list(
                                       extend = 'collection',
                                       buttons = c('csv', 'excel'),
                                       text = 'Download'
                                     ))
                    )
      )

【问题讨论】:

标签: r shiny dt


【解决方案1】:

这行得通:

buttons = list(list(extend = "excel", text = "Export to XLSX", filename = "yourCustomFileName"))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-12-08
    • 2018-04-12
    • 1970-01-01
    • 2012-11-19
    • 2010-12-24
    • 2017-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多