View unanswered posts | View active topics
It is currently Wed Nov 27, 2024 11:31 am
|
Page 1 of 1
|
[ 2 posts ] |
|
Author |
Message |
Hagne
|
Lock cells
I want to lock an Excel sheet from a java application.
How can I lock an entire Excel sheet or cell?
|
Wed Aug 09, 2006 2:10 am |
|
|
tavi
Joined: Fri Feb 03, 2006 12:23 pm Posts: 3
|
Re: Lock cells
Using EasyXLS, you can lock/unlock an excel sheet or a cell very easy. In the following sample code the worksheet is locked and the first cell ("A1") is unlocked.
// Create an instance of the object used to generate excel files
ExcelDocument xls = new ExcelDocument(1);
// Lock the worksheet
xls.easy_getSheetAt(0).setSheetProtected(true);
// Unlock the first cell
((ExcelWorksheet)xls.easy_getSheetAt(0)).easy_getExcelTable().easy_getCell("A1").setLocked(false);
// Generate the excel file
System.out.println("Writing the file C:\\ProtectedSheet.xls");
xls.easy_WriteExcelFile("C:\\ProtectedSheet.xls");
// Confirm generation[/color]
if (xls.easy_getError() == "")
System.out.println("File successfully created.");
else
System.out.println("Error encountered: " + xls.easy_getError());
// Dispose memory
xls.Dispose();
|
Wed Aug 09, 2006 7:34 am |
|
|
|
Page 1 of 1
|
[ 2 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|