Script, instance code, IE security settings Registry and instance Add a trust site registry: http://ded.nua.edu.cn/download/excel.rar
Doing the Web development, everyone has encountered printing, and printing a headache for complex forms, this article describes the solution to using Excel printing.
First, if the client calls Excel must reduce the IE security level, such illegal controls, such as 3721, all of which are automatically installed, so I solve this: Keep the original IE settings, add your site to the trust site, then change The security level of the secure site, which gives you a security channel, and prevents illegal intrusion of 3721, Of course, the premise is that you want to download a registry and install your customers, I am doing it yourself, use it yourself So I have to say anything I say, I have to do it, you need to convince customers :).
Ok, then the next step is how to achieve print, I have a very complex report, and some are very complicated, such as student transcripts, need to follow the school year, semester, printed photos, degree grants, student status, Sixty-six grades, internships, minus results, practice, etc., how can I print this information is very troublesome, all I use Excel, be a template, then call the template to fill the data, the problem , So much data, how to organize it, explore for a long time, suddenly there is an idea, write an object separately, so my procedure is more simple, and the best is that I can use it anywhere. . Also said that the transcript, the data is very large, more than 150 data, so my data source selects the form, so it doesn't matter what XML is generated, and it is the data I want. OK introduces GetTableData.js: It is the data object I want, the main function is to extract data (getTableData) and provide a method of output data (GetFieldData), which can meet my most demand. This is a profile I wrote, I am afraid that I forgot later :), let's see if I can't add it.
// OBJ parameter Specifies the source of the data (qualified table), the default first line is the field name row // MoveNext method, the parameter is the number of bits of the table, the number of digits moved downward, the positive number moves down, negative, negative. Such as. MoveNext (1) ,. MoveNext (-1) // getfielddata method Gets the number of specified column names in the current row, as: .GetfieldData ("Exam Score"): Column Name .GetfieldData (1): Index // Sort_Desc Methods The specified columns are arranged in descending order, such as .Sort_Desc ("school year", "semester") // sort_asc method to arrange the specified column, such as .Sort_asc ("Test Score: Number"): ":" The parameter develops the data type, this example returns the data array of the number // GetData method to the field value for a particular value. If there is no field value, all the field records can be returned. You can do other processing outside the outside, do not recommend direct processing data: .Getdata () // delete method Deletes the current record, an array reduces a row, such as .delete // updatefield updates the specified index data of the current row (if it is a number, the index of the column is character, is the data field Names) such as: MyData.UpdateField ("course number", mydata.getfielddata ("Original course number)) // MoveFirst record moves to the first record of the data, pay attention to the data from the second line, default first behavior field Name Row // MoveLast Record Moves the last record of data // distinct Returns a number of digital dimensional arrays for different records of the selected record, while ordering sorting // initialization, OBJ: Table, Leftlen: Excess data length Rightlen: Amountable Data Length, // ROWS Attribute: Arrow number, cols: Column number in the sample code Print_bzcjd.js he is a script that prints complex Excel,
Var xlbook = xls.workbooks.open ("c: //xsxycjb.xls); var xlsheet = xlbook.worksheets (1)
This is the use of a network template,
Var xlbook = xls.workbooks.open ("http://you.com//printtemplates//xsxycjb.xls"); var xlsheet = xlbook.worksheets (1)
In this example, the technique of Excel printing needs is basically displayed, such as pictures, and what.
Here, it will be described here that the data of Table can be hidden, and it is not displayed, so that many data can be increased, and it does not affect the interface.
Excel.js: This is a script for cleaning the Excel. When it ends the Excel process, it has not been launched, clean it, this will not be VS :(.
This is a simple example, that is, you can give him a form name, then generate a table, that is, MakeExcel ("Table1", True, "1.xls"), other parameters do not.
Function MakeExcel (Obj, Procevisible, SaveasfileName, SortType, Sortfield) {var mydata = new gettabledata (Obj, 0, 0); var myrows = mydata.rows; var i, j;