7.1 Operating Effect:
2, Excel Import development implementation
2.1. Create a form, modify the namespace
The new form named "Frmimport table name", this import window compared to other windows will be special, need to inherit the Baseformimport parent form
2.2. Write methods in the new form
The constructor method is used to set the imported form name, and to download the import template name, specifying required columns.
2.3.AddItem is called when the "import data" event occurs, and each row of data is converted to a solid object, and we can manipulate the entity object to save or otherwise handle it.
2.4. Add Import button
2.5. In the Invoke button event write call the import form code as follows:
2.6. Setting up an Import template
2.7. Place the import template under the template folder in the project directory for download templates
Note: If you add the need to select a template file in the development environment, right-click the "newer copy" option.
2.8. The development completes the import to try, downloads the template and so on operation.
Note: The above rewriting methods are described separately:
1, Frmimportorganize is the construction method:
This. Name = "form program name";
This. Text = "What table data is imported";//Import Form Chinese name
The column name of the imported Excel is a required field item.
Needexistcolumnname = new string[] {"Number", "name", "valid", "Internal organization"};
Import template file name for Excel
Importtemplate = "Importorganizetemplate";
2, Convert2entity Method:
This method is called by each row when the imported file is saved, and the table row data is converted to an entity object that can be saved.
The entity object that corresponds to the imported data table to be manifested.
Note: It is important to note that the Import field name here is in Chinese, which is the name in the header row in Excel.
3, AddItem method:
is the entity object that transforms the Convert2entity method into a database.
To invoke the service method that corresponds to the data table being imported.
4, the Import template storage path: \template folder.
This series of tutorial documents, welcome reprint:
SNF Development platform WinForm Ten-excel import http://www.cnblogs.com/spring_wang/p/6128604.html
SNF Development Platform WinForm Nine-code generator usage Instructions http://www.cnblogs.com/spring_wang/p/6128595.html
SNF Development Platform WinForm Eight-automatic upgrade program deployment usage Instructions http://www.cnblogs.com/spring_wang/p/6128570.html
SNF Development Platform WinForm VII-document printing and usage instructions http://www.cnblogs.com/spring_wang/p/6126016.html
SNF Development Platform WinForm vi-Upload download components using http://www.cnblogs.com/spring_wang/p/6125929.html
SNF Development Platform WinForm-Advanced query usage Instructions-http://www.cnblogs.com/spring_wang/p/6116640.html
SNF Development Platform WinForm four-development-main Fine Table Management page-http://www.cnblogs.com/spring_wang/p/6116626.html
SNF Development Platform WinForm-development-Single table select control Creation-http://www.cnblogs.com/spring_wang/p/6116592.html
SNF Development Platform WinForm II-development-single-table Form Management page-http://www.cnblogs.com/spring_wang/p/6116572.html
One of the SNF development platform WinForm-development-Single table table editing management page-http://www.cnblogs.com/spring_wang/p/6116523.html
WinForm Development Framework for universal Windows camera calls to take pictures http://www.cnblogs.com/spring_wang/p/6008674.html
WinForm Development Framework Chart Report online designer 2-chart-snf.easyquery Project--SNF rapid development Platform 3.3-spring.net.framework
WinForm Development Framework Chart Report online designer-report-snf.easyquery Project--SNF rapid development Platform 3.3-spring.net.framework
WinForm Development framework of the common accessories management Module--SNF Rapid development platform 3.3-spring.net.framework
Snfautoupdater Universal Auto-upgrade Component V2.0-winform
SNF Rapid Development Platform 3.2--. net extensible Document number generator-snf.coderule
SNF Rapid Development Platform 3.1--Audit flow (3) Low-key luxury, simple and uncommon, example demo-snf.workflow
SNF Rapid Development Platform 3.1--Audit flow (2) process design-snf.workflow function instruction
SNF Rapid Development Platform 3.1--Audit flow (1) SNF. Introduction to Workflow Audit flow
SNF Rapid Development Platform 3.0--Perfect code generator snf.codegenerator-Quick Developer's weapon
--spring.net.frameworkv3.0 General introduction of Web development framework based on Mvc4+easyui
SNF Rapid Development Platform 3.0--MVC Printing Solution
SNF Rapid Development Platform 3.0--File batch upload-Unified Attachment Manager-Online Preview file (with Internet and no two)
SNF Rapid Development Platform 3.0--asp.net MVC4 powerful export and bulk import without uploading files to excel
SNF Rapid Development Platform 3.0 MVC Universal Control Library show-asp.net+mvc4.0+webapi+easyui+knockout
SNF Rapid Development Platform 3.0 of the BS page show and nine advantages-part of the page display effect-asp.net+mvc4.0+webapi+easyui +knockout
SNF Rapid Development Platform 3.0-interface Personalization + 10 skins + 7 Menu-asp.net+mvc4.0+webapi+easyui+knockout
SNF Rapid Development Platform 3.0-cs page-asp.net+spring.net.framework
SNF Rapid Development Platform 3.0-the role of broadcasting in the system-quickly and concisely send the message to the receiver
SNF Development platform WinForm Ten-excel import-SNF rapid development platform 3.3-spring.net.framework