Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Frans de Jong 548 posts 1840 karma points MVP 3x c-trib
    Jan 30, 2017 @ 08:10
    Frans de Jong
    1

    Excel export in custom dashboard

    Hi all,

    I'm working on my first custom dashboard with a Excel export button on it.

    What I want to do is onclick of the button in the dashboard call a method witch exports the excel and start a download to a client.

    Where I am now:

    I have a controller with a method that exports the excel if I call it directly in the url. It returns a response with a excel file generated with epplus.

    On the dashboard I have a button and I can call the url. The file it downloads is not the excel file but something that looks like a guid without a extension.

    How can I get the generated file (response) to go to the backoffice?

    Thanks a lot guys!! Frans

  • Frans de Jong 548 posts 1840 karma points MVP 3x c-trib
    Jan 30, 2017 @ 08:31
    Frans de Jong
    0

    I found a simple solution, that's putting the link to the file in the href of anchor. But now there is no way to check if something went wrong wile generating the file.

    So for me the preferred way would be to run it through a angular controller.

  • Frans de Jong 548 posts 1840 karma points MVP 3x c-trib
    Mar 17, 2017 @ 13:39
    Frans de Jong
    0

    Anybody?

  • Damien Holley 179 posts 540 karma points
    Oct 30, 2018 @ 08:31
    Damien Holley
    0

    I am doing this at the moment, I will let you know if I find a solution, did you find anything that does not require modding the core config file?

  • Frans de Jong 548 posts 1840 karma points MVP 3x c-trib
    Oct 30, 2018 @ 08:38
    Frans de Jong
    0

    Wow, this is a while ago :P

    As I remembered this was a security issue in my case and I ended up using the workaround stated above. We dropped the client so I didn't investigate further. I am curious if you find anything though.

  • Damien Holley 179 posts 540 karma points
    Oct 30, 2018 @ 11:13
    Damien Holley
    0

    :D

    I got it to work, but had to manually edit the dashboard config file :( hopefully v8 is a bit better for modding.

    I am outputting my file from a controller which is using the UmbracoAuth and the button on the panel uses a POST form submission. The controller function returns a FileResult object that I construct in my code, this automatically becomes a download when returned.

    I dislike angular (why the overhead of two lots of MVC patterns?) so I avoid using it whenever possible.

Please Sign in or register to post replies

Write your reply to:

Draft