Helping you always. Don't forget to click "Mark as Answer" on the post that helped you.
♠ ASP.NET Core Tutorials → Start from the Beginning and become an Expert in 30 days time ♠
From your code snippet, it seems that you are using EEPlus, GemBox and other packages or components and use the non-existing method in your code.You need to install all the packages and check what methods they contains.
Since this is no related to asp.net core development, you could ask how to use these packages on stackoverflow:
Member
1 Points
48 Posts
Export Database Data In Excel File
Feb 12, 2019 03:52 PM|ohoud|LINK
hi
i was building web application that connect to Database and this is my code
how i can export SqlDataReader in excel sheet file?
All-Star
58124 Points
15633 Posts
Re: Export Database Data In Excel File
Feb 12, 2019 07:56 PM|bruce (sqlwork.com)|LINK
you're in luck, the open xml sdk has a .net core version:
https://github.com/OfficeDev/Open-XML-SDK
they say to use 2.5 docs:
https://docs.microsoft.com/en-us/office/open-xml/open-xml-sdk
google for open xml examples for excel.
Contributor
2253 Points
735 Posts
Re: Export Database Data In Excel File
Feb 13, 2019 09:11 AM|Xing Zou|LINK
Hi ohoud,
For exporting data to excel, you could use OpenXml or NPOI.
I create a demo using OpenXml to export SqlDataReader data (one Table data) to excel. You could refer to How to: Insert a new worksheet into a spreadsheet
1.Install OpenXml SDK:
2.In controller:
Xing
Member
1 Points
48 Posts
Re: Export Database Data In Excel File
Feb 23, 2019 11:53 AM|ohoud|LINK
thank you for your help
after reading your code and do a lot of research
this is the code i end with
but i am facing multiple errors i don't know how to solve it
1) ExcelPaxkge doesn't have constructor
2)ExcelPaxkge doesn't contain definition GetAsByteArray
3)response doesn't contain definition BinaryWrite , AutoFitColumns , End
can you help me to solve it
Participant
1253 Points
935 Posts
Re: Export Database Data In Excel File
Feb 23, 2019 03:14 PM|yogyogi|LINK
You can use Microsoft.Office.Interop.Excel DLL to export data to excel format. This tutorial: How to Export Database Records into Excel File in ASP.NET MVC will help you in solving your problem.
♠ ASP.NET Core Tutorials → Start from the Beginning and become an Expert in 30 days time ♠
Contributor
2253 Points
735 Posts
Re: Export Database Data In Excel File
Feb 25, 2019 07:34 AM|Xing Zou|LINK
Hi ohoud,
From your code snippet, it seems that you are using EEPlus, GemBox and other packages or components and use the non-existing method in your code.You need to install all the packages and check what methods they contains.
Since this is no related to asp.net core development, you could ask how to use these packages on stackoverflow:
https://stackoverflow.com/questions/tagged/epplus
Xing