Magicodes.IE Library Overview
A comprehensive import/export library supporting Dto operations and dynamic exports for Excel, Word, PDF, CSV, and HTML formats. This project is part of the NCC open source organization.
Version 2.2 Release Notes
Latest Version: 2.2.0
May 12, 2020
- [NuGet] Updated version to 2.2.0
- [Excel Template Export] Added support for byte array export
- [Documentation] Added CSV import/export guide
- [Excel Import/Export] Fixed annotation addition issues
- [Export] Added support for custom formatters in ASP.NET Core Web API for Excel, PDF, and CSV exports (#64)
- [Import/Export] Added support for System.ComponentModel.DataAnnotations attributes to control import/export behavior (#63)
April 16, 2020
- [NuGet] Updated version to 2.2.0-beta9
- [Excel Template Export] Fixed export issue when only one column exists (#73)
- [Excel Import] Added support for returning headers and indices (#76)
- [Excel Import/Export] Enhanced DataAnnotations support (#63):
- Support for DisplayAttribute, DisplayFormatAttribute, DescriptionAttribute
- Added IEIgnoreAttribute for properties and enum members
April 2, 2020
- [NuGet] Updated version to 2.2.0-beta8
- [Excel Template Export] Added image support (#62) with syntax:
{{Image::ImageUrl?Width=50&Height=120&Alt=404}}
{{Image::ImageUrl?w=50&h=120&Alt=404}}
{{Image::ImageUrl?Alt=404}}
March 29, 2020
- [NuGet] Updated version to 2.2.0-beta7
- [Excel Template Export] Fixed rendering issues (#51)
March 27, 2020
- [NuGet] Updated version to 2.2.0-beta6
- [Excel Import/Export] Fixed package reference issues for .NET Core 2.2 (#68)
March 26, 2020
- [NuGet] Updated version to 2.2.0-beta4
- [Excel Multi-Sheet Export] Fixed issue #66 and added unit tests
March 25, 2020
- [NuGet] Updated version to 2.2.0-beta3
- [Excel Import] Fixed date handling issues (#68)
- [Excel Export] Added ExcelOutputType setting for unformatted exports (#54)
March 19, 2020
- [NuGet] Updated version to 2.2.0-beta2
- [Excel Import] Fixed date format import bugs, supporting DateTime, DateTimeOffset, and nullable types with localized time formats
- [Excel Import/Export] Added ExportAndImportUseOneDto_Test unit test (#53)
March 18, 2020
- [NuGet] Updated version to 2.2.0-beta1
- [Excel Export] Added new APIs:
public interface IExcelExporter
{
ExcelExporter AddData<T>(ICollection<T> items) where T : class;
Task<ExportFileInfo> GenerateFile(string outputPath);
Task<byte[]> GenerateBytes();
}
- [Excel Export] Multi-entity multi-sheet export support (#50, #pr52):
var exporter = new ExcelExporter();
var firstDataSet = GenFu.GenFu.ListOf<ExportTestDataWithAttrs>();
var secondDataSet = GenFu.GenFu.ListOf<ExportTestDataWithSplitSheet>(30);
var exportResult = exporter.AddData(firstDataSet).AddData(secondDataSet).GenerateFile(filePath);
Key Features
- DTO-based import/export with attribute configuration
- Various filters for multilingual and dynamic column display secnarios
- Custom text filtering for exports
- Automatic skipping of empty rows during import
- Template generation with automatic required field marking
- Data dropdown selection (enum types only)
- Whitespace handling for imported data
- Template validation and data verification
- Configurable header position (default: row 1)
- Column order flexibility during import
- Multi-sheet export capability with MaxRowNumberOnASheet property
- Error annotation for import Excel files
- Customizable stop column settings
- HTML, Word, and PDF export with custom templates
- Receipt export functionality
- Duplicate validation support
- Single data template export for receipts and credentials
- Dynamic column export based on DataTable (auto-split at 1M+ rows)
- Value mapping through ValueMappingAttribute
Value Mapping Example
[ImporterHeader(Name = "Gender")]
[Required(ErrorMessage = "Gender cannot be empty")]
[ValueMapping("Male", 0)]
[ValueMapping("Female", 1)]
public GenderType Sex { get; set; }
Enum Support Example
public enum StudentStatus
{
[Display(Name = "Active")]
Active = 0,
[Description("Transferred Out")]
LeftSchool = 1,
[Display(Name = "Suspended")]
OnLeave = 2,
[Display(Name = "Work-Study")]
WorkingStudent = 3,
[Display(Name = "Internship")]
Interning = 4,
[Display(Name = "Graduated")]
Completed = 5,
[Display(Name = "Military Service")]
InService = 6,
}
Template Rendering Syntax
{{CompanyName}} // Cell rendering
{{Table>>BookData|RowNumber}} // Table start syntax
{{Comments|>>Table}} // Table end syntax
{{Image::ImagePath?Width=50&Height=120&Alt=Missing}} // Image rendering
{{Image::ImagePath?w=50&h=120&Alt=Missing}} // Image rendering
{{Image::ImagePath?Alt=Missing}} // Image rendering
Package Information
Important Notes
- Excel import does not support ".xls" files (Excel97-2003 format)
- Docker usage requires special configuration - see documentation
- All features have corresponding unit tests for reference
Tutorials Available
- Student data import tutorial
- Excel export basics
- PDF receipt export
- Docker deployment guide
- Dynamic export (pending)
- Multi-sheet import (pending)
- CSV import/export
- Excel image import/export
- Textbook ordering template export
- Filter implementation (pending)
- Multi-entity export (pending)