.NET About the generation of enterprise Excel report

xiaoxiao2021-03-06  49

In a general enterprise application development, it will involve the generation of reports, and the format of the general report is generated in an Excel format. For the generation of various reports, it has always been the pain in the hearts of the programmer. Because every report is written for many programmers, it means to write a big break code, and some reports may be extremely complicated and irregular. At the time, the programmer will waste the programmer to write and debug these code. If there is any way to write the code as little as possible, and can achieve the generation of various Excel reports, let's transfer to the topic. We have to generate an Excel report, in fact, we only need two things: 1. What is the style of the report, which field should be filled, which list should be filled, the font size, color, cell height, width, cells are merged, Whether it is cross-line, whether it is a column, is a horizontal report (so-called horizontal report, I am customized as: an Excel report is a record that is recorded or has a record and its associated record, such as a order report usually has an order. Head and its related order details, this is my custom horizontal report) or longitudinal report (so-called longitudinal report, I am customized as: a report is that there is a recordset to generate, if you want to generate a record Reports of a class student situation, you have to export this class's student record to this report, this report is basically a statistical report, a report may have tens of thousands of records or more, this is I have a custom longitudinal report) and so on. 2. Data of the report, have a report style for us, we know which data should be filled in which data, specific data, we can behave in the form of DataTable or DataSet The form is expressive, as for how to use it, you can define it. Now we know that generating an Excel report As long as you have style and data, you can generate a report you want. The generation is not difficult, but our difficult is to describe the style of this report, how to describe .

For the description of the style we can implement: 1. Direct use of XML to describe that the primary description of this XML description file can be as follows (a list of lists, it is not very specific to the description now):