Export data to Excel and export data to Excel
First, let's look at the figure. This is the data exported to Excel using NPOI a few months ago. It uses hundreds of lines of code and is difficult to control. It is also difficult to export.
Excel opening Effect
The following is how I export data to Excel using the ExcelReport Class Library:
1. First, reference the ExcelReport class library and use NuGet.
2. Now you can write the exported code. ExcelReport provides a good API. If there are no more than 30 lines of code, you can export the code.
In comparison, the most important thing is that the customer can independently edit the template font and color.
If NPOI is used to output this format, it may take a few days.
Finally, it should be noted that if the data has a GUID type, it is exported as a null value, as long as GUID. ToString ().
Additional reading
Author Boyuan: http://www.cnblogs.com/hanzhaoxin/p/4472860.html
Another Yuan You based on ExcelReport Extension: http://www.cnblogs.com/zuowj/p/5133935.html (because he provided the API is mostly DataTable, more suitable for WinForm)