Skip to content

tarunbatta/ExcelExportCSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server Side Excel Export using C#

Introduction

This library is written in C#, and enables the developer to provide server side excel export feature with ease.

Features

  1. Easy to use.
  2. DataSet library features,
    1. Export multiple DataSet(s).
    2. Specify excel file name.
    3. Specify author name in excel sheet.
    4. Specify company name in excel sheet.
    5. Specify version of excel sheet.
    6. Specify header Fore Color and Background Color.
    7. Specify a different header text or any column.
    8. Hide any column.
    9. Custom width for a column.
    10. Specify Data type and format for a column.
  3. GridView library features,
    1. Export multiple GridView(s).
    2. Specify excel file name.
    3. Specify custom table header name.
    4. Specify header Fore Color and Background Color.
    5. Specify Footer Fore Color and Background Color.
    6. Specify Border Color and Width.

Example

ExcelSheet excel = new ExcelSheet
{
    fileName = "example_dataset",
    grids = new List
    {
        new Grid()
        { 
            tableName = "User Data", 
            dataTable = Data.Users, 
            headerForeColor =  "#333",
            headerBackgroundColor = "#777",
            columnsConfiguration = new List
            {
                new ColumnModel() { headerText = "User ID", columnName = "userId", style = new ExcelStyle() { dataType = typeof(int), dataFormat = string.Empty }, columnWidth= 50, isHidden = false },
                new ColumnModel() { headerText = "User Name", columnName = "name", style = new ExcelStyle() { dataType = typeof(string), dataFormat = string.Empty }, columnWidth= 100, isHidden = false },
                new ColumnModel() { headerText = "Age", columnName = "age", style = new ExcelStyle() { dataType = typeof(int), dataFormat = string.Empty }, columnWidth= 50, isHidden = false },
                new ColumnModel() { headerText = "Date Of Birth", columnName = "dob", style = new ExcelStyle() { dataType = typeof(DateTime), dataFormat = string.Empty }, columnWidth= 150, isHidden = false },
                new ColumnModel() { headerText = "Salary ($)", columnName = "salary", style = new ExcelStyle() { dataType = typeof(float), dataFormat = string.Empty }, columnWidth= 50, isHidden = false }
            }
        }, 
        new Grid()
        { 
            tableName = "Game Data", 
            dataTable = Data.Games, 
            headerForeColor =  "#FFFFFF",
            headerBackgroundColor = "#000000",
            columnsConfiguration = new List
            {
                new ColumnModel() { headerText = "Game ID", columnName = "gameId", style = new ExcelStyle() { dataType = typeof(int), dataFormat = string.Empty }, columnWidth= 50, isHidden = false },
                new ColumnModel() { headerText = "Game Name", columnName = "name", style = new ExcelStyle() { dataType = typeof(string), dataFormat = string.Empty }, columnWidth= 100, isHidden = false },
                new ColumnModel() { headerText = "Is Popular Game?", columnName = "isPopular", style = new ExcelStyle() { dataType = typeof(bool), dataFormat = string.Empty }, columnWidth= 150, isHidden = true }
            }
        }
    },
    author = "Tarun Batta",
    company = "Batta Tech Private Limited",
    version = "1.0.0"
};
 
if (excel != null)
{
    DataSetExport.Export(excel);
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published