26, "Open source framework" EFW framework WinForm Front-end development of Grid++report Report, barcode, Excel export, chart control

Source: Internet
Author: User

Back to the "open source" EFW Framework Series article index

EFW Framework Source code Download V1.2:http://pan.baidu.com/s/1hcnua

EFW Framework Instance source code download: Http://pan.baidu.com/s/1o6MAKCa

Introduction: This chapter describes some of the other commonly used controls other than the DotNetBar2 control suite, including Grid++report reports, barcodes, Excel export, and chart control zedgraph; Like these controls, there's too little free open source After a comparison and the use of feelings finally decided to integrate these controls into the EFW framework for everyone to choose to use;

This article highlights:

1.grid++report Report

2.Winform Program receives barcode

3.Excel Export Npoi

4. Chart Control Zedgraph

1.grid++report Report

Reference: http://www.rubylong.cn/index.htm

Grid++report is a high-performance report development tool, especially suitable for information management systems, such as ERP, invoicing, financial and other software report development. The paper has been specially implemented for the bill set, and it is also a good tool to realize the paper printing. Grid++report is a fully programmable reporting tool and is the best choice for making dynamic reports. For the characteristics of Chinese-style report has been a lot of special design, is for the development of Chinese-style report tailored to a report tool.

The Grid++report component in the framework encapsulates a tool for designing reports, Report Designer. exe, which allows you to open a report file for design without installing the report tool;

For example, using the EFW framework to develop a report, call the framework of the Gridreport object to extract the DataTable data from the background into the report, the second step is to use the Report Tool design report file, run the program display report.

2.Winform program receives barcode

Reference: http://blog.sina.com.cn/s/blog_5387be9b0100osh8.html

Traditional access to Barcode gun data must be focused on the text box, so that the content of the bar code can be displayed on the text box, this practice is somewhat similar to the external keyboard (it is the equivalent of a keyboard from the message transfer), but if there is no input focus, each time you need to click a text box to get focus, More frequent words to the user is still very painful. What I want to achieve is that, in any case, as long as the scanner is working, my program will automatically activate and get the barcode information that is currently being entered.

Realize the idea: I use the USB port barcode scanner, carefully analyzed a bit, after the successful scan, in the form of keyboard key messages to the barcode input information to the system. This information can be conveniently obtained by means of a keyboard hook. But, how to distinguish the information is the keyboard or barcode input? Very simple, the barcode scanner in a short period of time entered at least 3 characters above the information, and "carriage return" as the end character, in this thought guidance, the perfect realization of the predetermined function.

Solve the above problem, enter the bar code will also encounter another problem, that is, bar code must be more than one type, such as: Employee work number bar code, document barcode, etc., the previous practice is to put several text box control on the interface, focus on which text box to scan the corresponding bar code, and the above form to receive the way, No need to focus that can not be differentiated; At this time we need in the bar code up and down, that is, bar code generation to define a set of specific rules, access to bar code, according to this rule can judge what type of bar code, bar code rules can be by length, can also be special characters, I suggest that each bar code preceded by a field to distinguish the type of bar code, this method is relatively simple point;

Using the EFW framework to obtain the data of the scanner, first the form code overrides the inherited BaseForm base class Dobarcode method, you can obtain the scanned data from the parameter barcode, and then according to the barcode rules of scanning to determine the barcode type, and then carry out related business operations;

3.Excel Export (npoi)

Reference: http://npoi.codeplex.com/

With Npoi, you can read and write Word/excel documents on a machine that does not have Office installed or the appropriate environment. Npoi is built on the POI 3.x version, which can read and write Word/excel documents without Office installation.

(a) The traditional operation of Excel encountered problems:

1, if it is. NET, need to install Office on the server, and update it in time, in case of vulnerability, also need to set permissions permission. NET access to COM +, if something goes wrong during the export, it can cause the server to go down.

2, Excel will only contain the number of columns for type conversion, originally text-based, Excel will convert it into a numeric type, such as the number 000123 will become 123.

3, export, if the field content with "-" or "=" beginning, Excel will use it as a formula, will be error.

4, Excel will analyze the data type according to the first 8 rows of the Excel file, if it happens that the first 8 row of a column is just a number, it will think that the column is a numeric type, automatically convert it to resemble the 1.42702E+17 format, the date column becomes the date and the number.

(ii) Advantages of using Npoi

1. You can use the framework completely for free

2. Contains most Excel features (cell style, data format, formula, etc.)

3. The file format that supports processing includes XLS, xlsx, docx.

4, adopt interface-oriented design architecture (can view Npoi. The namespace of the SS)

5. Support file import and export at the same time

6.. NET 2.0 also supports xlsx and docx formats (and, of course,. NET 4.0)

7, a large number of instance code

8, you do not need to install Microsoft Office on the server, you can avoid copyright issues.

9. It is more convenient and user-friendly than the Office PIA API.

Npoi is powerful not because it supports exporting Excel, but because it supports importing Excel and can "understand" the OLE2 document structure, which is the weaker aspect of other Excel read-write Cubby. In general, reading and understanding structures is far more complex than exporting, because you have to assume that everything is possible, and that you just have to make sure that you meet your own needs, and that if you make two sets of import requirements and build requirements, the build requirements are usually a subset of the import requirements. This rule is not only reflected in the Excel read-write library, but also in the PDF read-write library, the majority of the current market for the PDF library only support generation, do not support import.

For example, using the EFW framework to export an Excel file is simple, call the export method of the Excelhelper object, this method takes four parameters, dtsource the data source, strheadertext the title of Excel, ColumnNames set the English column name of the data source into Chinese name, strFileName export the Excel file name;

4. Chart Control Zedgraph

Reference: http://www.cnblogs.com/gaizai/archive/2010/02/22/1671154.html

Zedgraph is an open source. NET Chart Class library, all the code is developed in C #. It can create 2D linear and column charts with any set of data.

The Zedgraph class library has a high level of flexibility. Almost every level of the chart can be modified by the user. At the same time, all chart properties provide default values to ensure the ease of use of the class library. The code contained in a class library can select the scale range and size to fit according to the data being divided. Zedgraph inherits the UserControl interface in the framework, allowing users to drag-and-drop operations in the IDE environment of VS.

For example, use the EFW frame to draw a pie chart, fetch the DataTable data from the background, then parse the data using the Cakygraphcontrol object, and draw a pie chart bound to the Panel control on the interface;

In short, the above is just to tidy up some of the system's commonly used functional components, the subsequent continuous strengthening of the framework of components, more powerful and better components to join in;

26, "Open source framework" EFW framework WinForm Front-end development of Grid++report Report, barcode, Excel export, chart control

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.