下载时自定义文件名

时间:2020-06-22 13:56:35

标签: r shiny dt

是否可以使用自定义文件名下载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'
                                     ))
                    )
      )

1 个答案:

答案 0 :(得分:0)

这有效:

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