In my shiny app, I'm using:
# server.R
output$out_table = DT::renderDataTable(
func_to_creat_dataframe(),
rownames= FALSE,
extensions = c('Buttons'),
options = list(
pageLength = 96,
lengthMenu = c(96, 384, 1536),
dom = 'Blfrtip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')
)
)
# UI.R
DT::dataTableOutput('out_table')
...and when I use the "Excel" button to export the table, the exported table has a "title" row directly above the header row. This title row consists of one merged cell that spans across the entire header. How do I remove this? This title row interferes with downstream processing of the file, and it's completely unnecessary, so I don't see why it appears to be default for the datatable file export buttons.
Try that:
DT::datatable(
iris,
rownames= FALSE,
extensions = c('Buttons'),
options = list(
pageLength = 96,
lengthMenu = c(96, 384, 1536),
dom = 'Blfrtip',
buttons = list(
'copy',
'csv',
list(extend = 'excel', title = NULL),
'pdf',
'print'
)
)
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.