Objective
C # using a self-contained library (Excel 11.0/5.0 Object Library) to manipulate Excel has always been a problem, the most serious number of times the Excel process can not end this problem, operation is not very convenient. In fact, Excel used a little bit of friends know that Excel can be exported to HTML format files, I would like to say that here we should have a general understanding of the intent of this article, I do for you to do an example.
Environment
1. Microsoft Office Excel 2003
Body
I. Purpose
Export data from the database to Excel and lock some of the data to make no changes. Here, for example, student grade, student number, student name, student score three fields extracted from the database, and locked, the teacher evaluation column can be entered after export.
Second, realize
1. Make Excel "template"
Note that the template here does not refer to the template in Excel, which is primarily prepared for later export as HTML.
1.1 New Excel, name is Student score sheet. xls.
1.2 Set column name columns, format fonts and other information, the final form of the format, as shown:
How to freeze a window: for example, to freeze the first row, select the first cell in the second row, the toolbar-> the window-> the window.