Unreadable content in Excel file generated with EPPlus

前端 未结 7 929
谎友^
谎友^ 2021-01-04 02:57

I\'m having a little problem when I generate an Excel file from a template, using the EPPlus library. The file has a first spreadsheet that contains data that is used for po

相关标签:
7条回答
  • 2021-01-04 03:48

    I just ran into this problem myself and fixed it, putting my solution here should someone else run into it:

    This was using asp.net, for obvious reasons it's not applicable otherwise.

    My problem wasn't the table range, Epplus generated the file just fine, but rather that the server response was appending the page response to the excel file, obviously making the file invalid. Ending the server response immediately after sending the file fixed my problem, something to the tune of:

    Response.BinaryWrite(pck.GetAsByteArray());  // send the file
    Response.End();
    
    0 讨论(0)
提交回复
热议问题