Lock cells in Excel [Post]

Source: Internet
Author: User
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

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.