All Projects → fingers10 → ExcelExport

fingers10 / ExcelExport

Licence: MIT license
Classes to generate Excel/CSV Report in ASP.NET Core

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to ExcelExport

ProductsStoreOnKubernetes
Demoing deployment of Docker containers into Kubernetes for both minikube and Azure AKS.
Stars: ✭ 90 (+130.77%)
Mutual labels:  asp-net-core, asp-net-core-mvc
AspNetCore.Unobtrusive.Ajax
Unobtrusive Ajax Helpers (like MVC5 Ajax.BeignForm and Ajax.ActionLink) for ASP.NET Core
Stars: ✭ 46 (+17.95%)
Mutual labels:  asp-net-core, asp-net-core-mvc
XAF Security E4908
This repository contains examples for Role-based Access Control, Permission Management, and OData / Web / REST API Services for Entity Framework and XPO ORM
Stars: ✭ 47 (+20.51%)
Mutual labels:  asp-net-core, asp-net-core-mvc
Demo.Ndjson.AsyncStreams
Sample project for demonstrating how to use async streams and NDJSON to improve user experience by streaming JSON objects from server to client and client to server in .NET
Stars: ✭ 30 (-23.08%)
Mutual labels:  asp-net-core, asp-net-core-mvc
MvcControlsToolkit.Core
Core Code for MvcControlsToolkit packages
Stars: ✭ 13 (-66.67%)
Mutual labels:  asp-net-core, asp-net-core-mvc
statiq-starter-kontent-lumen
Lumen is a minimal, lightweight, and mobile-first starter for creating blogs using Statiq and Kontent by Kentico.
Stars: ✭ 22 (-43.59%)
Mutual labels:  asp-net-core, asp-net-core-mvc
PersianDataAnnotations
PersianDataAnnotations is ASP.NET Core MVC & ASP.NET MVC Custom Localization DataAnnotations (Localized MVC Errors) for Persian(Farsi) language - فارسی سازی خطاهای اعتبارسنجی توکار ام.وی.سی. و کور.ام.وی.سی. برای نمایش اعتبار سنجی سمت کلاینت
Stars: ✭ 38 (-2.56%)
Mutual labels:  asp-net-core, asp-net-core-mvc
Yii2 Export
A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)
Stars: ✭ 153 (+292.31%)
Mutual labels:  export, excel
OnlineUsers-Counter-AspNetCore
Display online users count in ASP.NET Core in two ways (Cookie - SingalR)
Stars: ✭ 29 (-25.64%)
Mutual labels:  asp-net-core, asp-net-core-mvc
eShopOnWeb
Sample ASP.NET Core 6.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
Stars: ✭ 8,250 (+21053.85%)
Mutual labels:  asp-net-core, asp-net-core-mvc
vue-datagrid
Spreadsheet data grid component. Handles enormous data processing.
Stars: ✭ 171 (+338.46%)
Mutual labels:  export, excel
Reports.JS
Stimulsoft Reports.JS is a reporting tool for Node.js and JavaScript applications.
Stars: ✭ 33 (-15.38%)
Mutual labels:  export, excel
SeoTags
SeoTags create all SEO tags you need such as meta, link, twitter card (twitter:), open graph (og:), and JSON-LD schema (structred data).
Stars: ✭ 113 (+189.74%)
Mutual labels:  asp-net-core, asp-net-core-mvc
sense-export
Just a simple button to export data in your Qlik Sense applications.
Stars: ✭ 28 (-28.21%)
Mutual labels:  export, excel
Portphp
Data import/export framework for PHP
Stars: ✭ 225 (+476.92%)
Mutual labels:  export, excel
AspNetCore.FriendlyExceptions
ASP.NET Core Filter and Middleware to catch exceptions and translate them into nice HTTP responses
Stars: ✭ 17 (-56.41%)
Mutual labels:  asp-net-core, asp-net-core-mvc
Excellentexport
Javascript export to Excel
Stars: ✭ 1,018 (+2510.26%)
Mutual labels:  export, excel
Revogrid
Powerful virtual data grid smartsheet with advanced customization. Best features from excel plus incredible performance 🔋
Stars: ✭ 1,870 (+4694.87%)
Mutual labels:  export, excel
Samples-JS-PHP
JavaScript and PHP samples for Stimulsoft Reports.PHP reporting tool.
Stars: ✭ 17 (-56.41%)
Mutual labels:  export, excel
filefy
A javascript library to produce downloadable files such as in CSV, PDF, XLSX, DOCX formats
Stars: ✭ 39 (+0%)
Mutual labels:  export, excel

NuGet Badge Open Source Love svg1

GitHub license Maintenance Ask Me Anything ! HitCount

GitHub forks GitHub stars GitHub followers

GitHub contributors GitHub issues GitHub issues-closed

Excel Export

Simple classes to generate Excel/CSV Report in ASP.NET Core.

To export/download the IEnumerable<T> data as an excel file, add action method in your controller as shown below. Return the data as ExcelResult<T>/CSVResult<T> by passing filtered/ordered data, sheet name and file name. ExcelResult/CSVResult Action Result that I have added in the Nuget package. This will take care of converting your data as excel/csv file and return it back to browser.

Note: This tutorial contains example for downloading/exporting excel/csv from Asp.Net Core Backend.

Give a Star ⭐️

If you liked ExcelExport project or if it helped you, please give a star ⭐️ for this repository. That will not only help strengthen our .NET community but also improve development skills for .NET developers in around the world. Thank you very much 👍

Columns

Name

Column names in Excel Export can be configured using the below attributes

  • [Display(Name = "")]
  • [DisplayName(“”)]

Report Setup

To customize the Excel Column display in your report, use the following attribute

  • [IncludeInReport]
  • [NestedIncludeInReport]

And here are the options,

Option Type Example Description
Order int [IncludeInReport(Order = N)] To control the order of columns in Excel Report

Please note: From v.2.0.0, simple properties in your models with [IncludeInReport] attribute will be displayed in excel report. You can add any level of nesting to your models using [NestedIncludeInReport] attribute.

NuGet:

Package Manager:

PM> Install-Package Fingers10.ExcelExport

.NET CLI:

> dotnet add package Fingers10.ExcelExport

Root Model

public class DemoExcel
{
    public int Id { get; set; }

    [IncludeInReport(Order = 1)]
    public string Name { get; set; }

    [IncludeInReport(Order = 2)]
    public string Position { get; set; }

    [Display(Name = "Office")]
    [IncludeInReport(Order = 3)]
    public string Offices { get; set; }

    [NestedIncludeInReport]
    public DemoNestedLevelOne DemoNestedLevelOne { get; set; }
}

Nested Level One Model:

public class DemoNestedLevelOne
{
    [IncludeInReport(Order = 4)]
    public short? Experience { get; set; }

    [DisplayName("Extn")]
    [IncludeInReport(Order = 5)]
    public int? Extension { get; set; }

    [NestedIncludeInReport]
    public DemoNestedLevelTwo DemoNestedLevelTwos { get; set; }
}

Nested Level Two Model:

public class DemoNestedLevelTwo
{
    [DisplayName("Start Date")]
    [IncludeInReport(Order = 6)]
    public DateTime? StartDates { get; set; }

    [IncludeInReport(Order = 7)]
    public long? Salary { get; set; }
}

Action Method

public async Task<IActionResult> GetExcel()
{
    // Get you IEnumerable<T> data
    var results = await _demoService.GetDataAsync();
    return new ExcelResult<DemoExcel>(results, "Demo Sheet Name", "Fingers10");
}

public async Task<IActionResult> GetCSV()
{
    // Get you IEnumerable<T> data
    var results = await _demoService.GetDataAsync();
    return new CSVResult<DemoExcel>(results, "Fingers10");
}

Page Handler

public async Task<IActionResult> OnGetExcelAsync()
{
     // Get you IEnumerable<T> data
    var results = await _demoService.GetDataAsync();
    return new ExcelResult<DemoExcel>(results, "Demo Sheet Name", "Fingers10");
}

public async Task<IActionResult> OnGetCSVAsync()
{
     // Get you IEnumerable<T> data
    var results = await _demoService.GetDataAsync();
    return new CSVResult<DemoExcel>(results, "Fingers10");
}

Target Platform

  • .Net Standard 2.0

Tools Used

  • Visual Studio Community 2019

Other Nuget Packages Used

  • ClosedXML (0.95.0) - For Generating Excel Bytes
  • Microsoft.AspNetCore.Mvc.Abstractions (2.2.0) - For using IActionResult
  • System.ComponentModel.Annotations (4.7.0) - For Reading Column Names from Annotations

Author

  • Abdul Rahman - Software Developer - from India. Software Consultant, Architect, Freelance Lecturer/Developer and Web Geek.

Contributions

Feel free to submit a pull request if you can add additional functionality or find any bugs (to see a list of active issues), visit the Issues section. Please make sure all commits are properly documented.

License

ExcelExport is release under the MIT license. You are free to use, modify and distribute this software, as long as the copyright header is left intact.

Enjoy!

Sponsors/Backers

I'm happy to help you with my Nuget Package. Support this project by becoming a sponsor/backer. Your logo will show up here with a link to your website. Sponsor/Back via Sponsor via PayPal

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].