EPPlus with MemoryStream as email attachment — file is empty

前端 未结 1 607
夕颜
夕颜 2021-02-05 05:45

I\'m building a console app that moves data into an excel file (using EPPlus library). I\'m saving the ExcelPackage as a MemoryStream, and I want to attach it to an email. How

相关标签:
1条回答
  • 2021-02-05 06:13

    After some more searching, I found the solution. Apparently I needed to explicitly set the starting position of the MemoryStream before I passed it in as an attachment. The following line of code did the trick:

    outputStream.Position = 0;
    
    0 讨论(0)
提交回复
热议问题