Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
# | Status | Completion time | Milestone situation |
---|---|---|---|
3.0 | ☕In progress | 2021-02-31 | To Do |
2.5 | 🚩Completed | 2020-10-30 | Completed |
2.4 | 🚩Completed | 2020-09-30 | Completed |
2.3 | 🚩Completed | 2020-06-30 | Completed |
2.2 | 🚩Completed | 2020-04-31 | Completed |
2.1 | 🚩Completed | 2020-03-15 | Completed |
For details, see: https://dev.azure.com/xinlaiopencode/Magicodes.IE/_build?definitionId=4&_a=summary
Name | Nuget |
---|---|
Magicodes.IE.Core | |
Magicodes.IE.Excel | |
Magicodes.IE.Pdf | |
Magicodes.IE.Word | |
Magicodes.IE.Html | |
Magicodes.IE.Csv | |
Magicodes.IE.AspNetCore |
Sorry, due to limited energy, please help translate.
See below for other tutorials or unit tests
See below for update history.
[Fact(DisplayName = "DTO导出支持动态类型")]
public async Task ExportAsByteArraySupportDynamicType_Test()
{
IExporter exporter = new ExcelExporter();
var filePath = GetTestFilePath($"{nameof(ExportAsByteArraySupportDynamicType_Test)}.xlsx");
DeleteFile(filePath);
var source = GenFu.GenFu.ListOf<ExportTestDataWithAttrs>();
string fields = "text,number,name";
var shapedData = source.ShapeData(fields) as ICollection<ExpandoObject>;
var result = await exporter.ExportAsByteArray<ExpandoObject>(shapedData);
result.ShouldNotBeNull();
result.Length.ShouldBeGreaterThan(0);
File.WriteAllBytes(filePath, result);
File.Exists(filePath).ShouldBeTrue();
}
/// <summary>
/// 性别
/// </summary>
[ImporterHeader(Name = "性别")]
[Required(ErrorMessage = "性别不能为空")]
[ValueMapping(text: "男", 0)]
[ValueMapping(text: "女", 1)]
public Genders Gender { get; set; }
Support the generation of imported data verification items of enumeration and Bool type, and related data conversion
Enumeration will automatically obtain the description, display name, name and value of the enumeration by default to generate data items
/// <summary>
/// 学生状态 正常、流失、休学、勤工俭学、顶岗实习、毕业、参军
/// </summary>
public enum StudentStatus
{
/// <summary>
/// 正常
/// </summary>
[Display(Name = "正常")]
Normal = 0,
/// <summary>
/// 流失
/// </summary>
[Description("流水")]
PupilsAway = 1,
/// <summary>
/// 休学
/// </summary>
[Display(Name = "休学")]
Suspension = 2,
/// <summary>
/// 勤工俭学
/// </summary>
[Display(Name = "勤工俭学")]
WorkStudy = 3,
/// <summary>
/// 顶岗实习
/// </summary>
[Display(Name = "顶岗实习")]
PostPractice = 4,
/// <summary>
/// 毕业
/// </summary>
[Display(Name = "毕业")]
Graduation = 5,
/// <summary>
/// 参军
/// </summary>
[Display(Name = "参军")]
JoinTheArmy = 6,
}
The bool type will generate "yes" and "no" data items by default
If custom value mapping has been set, no default options will be generated
Support excel multi-sheet import
Support Excel template export, and support image rendering
The rendering syntax is as follows:
{{Company}} //Cell rendering
{{Table>>BookInfos|RowNo}} //Table rendering start syntax
{{Remark|>>Table}}//Table rendering end syntax
{{Image::ImageUrl?Width=50&Height=120&Alt=404}} //Picture rendering
{{Image::ImageUrl?w=50&h=120&Alt=404}} //Picture rendering
{{Image::ImageUrl?Alt=404}} //Picture rendering
Custom pipelines will be supported in the future.
Support Excel import template to generate annotation
Support Excel image import and export
Support multiple entities to export multiple Sheets
Support using some features under the System.ComponentModel.DataAnnotations namespace to control import and export #63
Support the use of custom formatter in ASP.NET Core Web API to export content such as Excel, Pdf, Csv #64
This project exists thanks to all the people who contribute. [Contribute].
Become a financial contributor and help us sustain our community. [Contribute]
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]
Sign in for post a comment
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.
Comments ( 2 )