Base solution for your next web application
Open Closed

Error downloading Excel sheet #2743


User avatar
0
bilalhaidar created

Hi, I've added a button download Excel sheet with some data. Actually last time I checked the code was yesterday night and it was working fine. I was able to download the excel.

Today, when I try to download, and while debugging I can see that the SaveAs method works fine and the file type is of type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

Then on the client side, I get redirected to a page: <a class="postlink" href="https://view.officeapps.live.com/op/errorpage.htm?llcc=en-US">https://view.officeapps.live.com/op/err ... llcc=en-US</a>

The Excel is not downloaded and I get redirected. What's there that I should do more?

Thanks


14 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Did this happen on your local machine or is it a deployed website ? If it is deployed, is it on azure ?

  • User Avatar
    0
    bilalhaidar created

    This is happening on my local development machine. why would that happen? It was working fine already.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Did you make any changes, maybe updated ABP on your project ?

    Probably something you make recently caused this problem but nothing comes to my mind at the moment. Have you tried it on another machine ?

  • User Avatar
    0
    bilalhaidar created

    It happened that the day before it was working fine, the next day, it stopped. I am trying on the same development machine, didn't try on another machine. That's so weird. I am sure I didn't change anything related to Excel generation.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    According to error message, app is redirecting you to office.com which is weird. Please send your project to us if it happens on another machine. If it works on another machine maybe we cannot reproduce the problem.

    Thanks.

  • User Avatar
    0
    bilalhaidar created

    Hi Ismail,

    The problem I am facing is not only with the custom code I added, but also when downloading Audit Logs.

    The problem appears on Google Chrome.

    On Microsoft Edge and Explorer, both work fine and Excel file is downloaded.

    Please try it on your side on Google Chrome. My version of Chrome is 56.x

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I have tried it with Chrome 56.x and it worked for me. Can you try it on demo.aspnetzero.com with Chrome ? We can fix it once we reproduce it but it is a hard one to do.

  • User Avatar
    0
    bilalhaidar created

    Same problem. See attached.

    The Chrome version is exactly: 56.0.2924.87 (64-bit)

    I have a feeling that a latest update for Chrome is causing this issue as it was working fine few days ago.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I have the exact same version with you. Did you install any chrome extension recently ?

    You can disable chrome extensions and try again.

  • User Avatar
    0
    bilalhaidar created

    I found it!

    I installed Office Offline extension. That was causing the problem. I removed it and it worked well.

    Question about Excel. Can I customize the Excel I am downloading? Like adding some headers etc. ?

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Of course, you can do that. Just modify the class with postfix ExcelExporter. For example this one is for audit logs <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Application/Auditing/Exporting/AuditLogListExcelExporter.cs#L33">https://github.com/aspnetzero/aspnet-ze ... ter.cs#L33</a>.

  • User Avatar
    0
    bilalhaidar created

    Thanks Ismail.

    Headers I meant some H1 Text with background etc. Can you refer me to the API you are using for excel for additional documentation on how to do so?

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Sorry :). We are using EPPlus library, you can check it's examples here <a class="postlink" href="http://epplus.codeplex.com/">http://epplus.codeplex.com/</a>, I think it is possible.

  • User Avatar
    0
    bilalhaidar created

    Thanks :)