When using an Excel table, some columns do not need to be modified by the user, such as the part identified in the audit log, and the auditor and audit time need to be modified by the auditor. Therefore, it involves whether different tables can be modified. 1. Use the following method in Excel:
Select the part you want others to fill in or modify, and right-click it:
Set cell format ---- protect -- clear the check mark before locking -- OK
Then select the tool -- protect the worksheet (the password is controlled by yourself, and leave it blank if you forget it) -- OK
2. First set in the cell attribute to be locked, "cell format" -- "Protect" -- "Lock", and then cancel "Lock" in the open cell attribute. Click "Tools"> "protection"> "protect worksheet"> "protect worksheet and locked cell content ", you can tick all the check boxes under "allow all users in the worksheet" in addition to "selected locked cells". You can also set a password for protection.
Of course, if you use jxl to operate the exported cells, you must first create an "unlock" in the Code in the following format: jxl. write. writablecellformat format_unlock = new jxl. write. writablecellformat ();
Format_unlock.setlocked (false); Determine the Excel file to be exported: outputstream OS = new fileoutputstream (excelname + ". xls ");
Writableworkbook WWB = Workbook. createworkbook (OS );
Writablesheet Ws = WWB. createsheet (excelname, 0); search for the required columns, add a new cell, and set the format for the cell to unlock if (fieldlist. get (I ). getattribute (). equals ("something ")){
WS. addcell (new label (I, row, ee. getsomething ()));
WS. getwritablecell (I, row). setcellformat (format_unlock );
} Finally, set the form in sheet to the protected format ws. setprotected (true). You can see that using jxl is mainly to find related functions and learn how to use them. See jexcelapi (the code in this article is the core of the Implementation) from: http://blog.csdn.net/studycandice/archive/2010/05/11/5577912.aspx