RaisExcelExport 1.5.0

dotnet add package RaisExcelExport --version 1.5.0                
NuGet\Install-Package RaisExcelExport -Version 1.5.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RaisExcelExport" Version="1.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RaisExcelExport --version 1.5.0                
#r "nuget: RaisExcelExport, 1.5.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RaisExcelExport as a Cake Addin
#addin nuget:?package=RaisExcelExport&version=1.5.0

// Install RaisExcelExport as a Cake Tool
#tool nuget:?package=RaisExcelExport&version=1.5.0                

RaisExcelExport

Note: In case error show while opening excel file, then make sure binding property data type is correct. (for example : Binding property may be Integer but you set it as Text

Create excel export as memory stream or physical file.

New Features!

  • Excel export in memorystream.
  • Save export to disk in .xlsx format.
  • HeaderRow background and foreground color.
using Rais;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Demo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        { 
            List<Object> Employees = new List<object>();
            for (int i = 1; i <= 10; i++)
            {
                Employees.Add(new Employee { SrNo = i, Name = null, JoiningDate = DateTime.Now.AddDays(i), Hike = 12.34 + i, Score = (i) - 100 });
            }

             RaisExcelExport exportObject = new RaisExcelExport();

            /* Use this link to convert RGB to Hex color : https://www.w3schools.com/colors/colors_rgb.asp */
            exportObject.DateFormat = "[$-409]d\\-mmm\\-yy;@";
            exportObject.HeaderBackgroundColorHex = "808080";
            exportObject.HeaderForeGround = "ffffff";
            exportObject.Columns.Add(new ExcelColumn() { BindToProperty = "SrNo", DataType = ExcelColumnDataType.Integer, HeaderText = "Sr. No.", Width = 20 });
            exportObject.Columns.Add(new ExcelColumn() { BindToProperty = "Name", DataType = ExcelColumnDataType.Text, HeaderText = "Employee Name", Width = 50 });
            exportObject.Columns.Add(new ExcelColumn() { BindToProperty = "JoiningDate", DataType = ExcelColumnDataType.Date, HeaderText = "Joining Date", Width = 15 });
            exportObject.Columns.Add(new ExcelColumn() { BindToProperty = "Hike", DataType = ExcelColumnDataType.Double, HeaderText = "Hike", Width = 10 });
            exportObject.Columns.Add(new ExcelColumn() { BindToProperty = "Score", DataType = ExcelColumnDataType.IntegerNegative, HeaderText = "Score", Width = 10 });

            exportObject.ExportList = Employees;
            exportObject.SheetName = "Employee List";

            /* Save to disk */
            exportObject.CreateExcelExport(@"c:\temp\EmployeeExport.xlsx");
              
            
            MemoryStream memoryStream = exportObject.CreateReportAsMemoryStream();

            System.Diagnostics.Process.Start(@"c:\temp\EmployeeExport.xlsx");

        }
    }


    public class Employee
    {
        public int SrNo { get; set; }
        public string Name { get; set; }
        public DateTime JoiningDate { get; set; }
        public double Score { get; set; }
        public double Hike { get; set; }
    }
}


License

MIT

Free Library

Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.0 812 1/31/2019
1.4.0 664 1/17/2019
1.1.0 637 1/15/2019
1.0.0 923 1/1/2019

Added Background and Foreground for header row. Removed generic list collection error. Will work for any List.
     Error handelled : Cannot implicitly convert type 'System.Collections.Generic.List' to 'System.Collections.Generic.List