Introduction to two-dimensional Excel Automation parsing class library

Source: Internet
Author: User

This kind of library is still in the idea, then will find time to implement it ~

Brief introduction:

This excel resolves a simple two-dimensional Excel into a C # list entity, preventing developers from repeating the wheel. Developers can define data specifications for Excel tables through a series of feature tags, and make simple check-up, such as length, size, non-nullable, and so on.

The Excel format supported by the idea is as follows:

Name Age Tel Address ISAdmin
Jax 18 15399126333 Xi'an True
Bob 52 15821487157 Yulin False

Eventually through this class library, you can parse to a list<person>, and each value in Excel is correctly populated with the object:

 Public classperson{ Public stringName {Get;Set; }  Public intAge {Get;Set; }  Public stringTel {Get;Set; }  Public stringAddress {Get;Set; }  Public BOOLISAdmin {Get;Set; }}

Realize:

1. Specify the name of the table header for the property, or the ordinal number of the column, by the attribute label on the object property, and finally locate the value of the cell to which the property is populated.

2. Define validation rules, similar to Required,maxlength, MinLength, MaxValue, availablevalues, by attribute labels on attributes, These feature tags are best used under the Sytem class library (what we usually write on ViewModel), and if not, define for yourself.

3. The types of int, string, Decimal, DateTime, Double, Bool, enum are supported first, and the nullable types of these types are supported (Int?,decimal?).

4. Support to verify that the Excel template used by the user is correct based on the table header text

Refer to: Https://github.com/chsword/Excel2Object/tree/master/Chsword.Excel2Object

This has achieved the basic function, but we have to expand on his basis some common methods, such as the validation of data legitimacy, template correctness and so on.

Introduction to two-dimensional Excel Automation parsing class library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.