Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to have Complex headers export to Excel and csv #764

Closed
3 tasks done
Rohit1310 opened this issue Feb 1, 2020 · 6 comments
Closed
3 tasks done

Unable to have Complex headers export to Excel and csv #764

Rohit1310 opened this issue Feb 1, 2020 · 6 comments
Milestone

Comments

@Rohit1310
Copy link

I have been trying to export the datatable using the Button extention of DT with a complex header for example as below:
extable

but I am getting only the last row in the header as below when exporting the datatable
extable1

I have searched alot but didn't got any satisfactory outcome.
I know this can be achieved using jquery but can you help me with some function in r.

Kindly help me to fix this issue.

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('DT'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/DT').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@stla
Copy link
Collaborator

stla commented Feb 1, 2020

Hello,

Not possible with datatables. You can use the TableExport library; see https://stackoverflow.com/questions/41966732/r-datatable-buttons-export-with-formated-cells/54350639#54350639.

@shrektan
Copy link
Collaborator

shrektan commented Feb 1, 2020

It will be possible after @mtyszler 's PR being merged to the upstream, i.e., the DataTables's Button extension. See the comment in PR #751 .

@shrektan
Copy link
Collaborator

shrektan commented Feb 1, 2020

Close this for now as it's duplicated with #418 .

@shrektan shrektan closed this as completed Feb 1, 2020
@shrektan shrektan added this to the v0.12 milestone Feb 1, 2020
@mtyszler
Copy link

mtyszler commented Feb 1, 2020

Dear @Rohit1310

Feel free to check my fork at https://github.com/mtyszler/DT/tree/feature/complex_headers

This fork is up-to-date with https://github.com/rstudio/DT master plus my complex_headers treatment.

You can fork it yourself or simply install using remotes::install_github('mtyszler/DT', ref = "feature/complex_headers")

If you prefer to copy, you only need:

  • dataTables.buttons.min.js
  • buttons.html5.min.js
  • buttons.print.min.js

which can be found at: https://github.com/mtyszler/DT/tree/feature/complex_headers/inst/htmlwidgets/lib/datatables-extensions/Buttons/js

@mtyszler
Copy link

mtyszler commented Feb 1, 2020

Also, @Rohit1310 , just be aware that the version I provided in DataTables/Buttons#170 is more complete, as it also handles complex footers, and the merges for pdf and print.

But for excel and csv export this will suffice.

@Rohit1310
Copy link
Author

Thanks @mtyszler for addressing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants