We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Blocking cell sellection

i am using the block of cell addition with fomula

(cell quals to it's self )

the edition of the sell is blocked ,but while selecting the cell and press "delete"

the cell contant gets deleted (which is no good ) i know theres a XLnoselection

how can i use it with aspse ?

can a look cell for edition and sellection ?

Yes, you can restrict the selection of a specific cell using Aspose.Cells, you can use the Cell.Style.isLock = true and use worksheet.Protection.IsSelectingLockedCellsAllowed = false. But in this scenario please remember that by default all the cells in a worksheet have the Style.isLocked property set to true, so you have to set the isLocked property of the cells you want to get selected to false manually through the code. Also, Excel’s advance protection only takes effect when you protect the worksheet. Please see the following Sample code in this regard,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


Sample Code:

Workbook excel = new Workbook();

//Opening the Excel file

excel.Open("C:\\book1.xls");

//Accessing the first worksheet in the Excel file

Worksheet worksheet = excel.Worksheets[0];

//Style Object

Style style;

//Style Flag

StyleFlag flag;

//Making all the Cells un-Locked

for (int i = 0; i <= 255; i++)

{

style = worksheet.Cells.Columns[(byte)i].Style;

style.IsLocked = false;

flag = new StyleFlag();

flag.Locked = true;

worksheet.Cells.Columns[(byte)i].ApplyStyle(style, flag);

}

style = worksheet.Cells.Rows[0].Style;

style.IsLocked = true;

flag = new StyleFlag();

flag.Locked = true;

worksheet.Cells["A10"].Style.IsLocked = true;

//protecting a worksheet with password

worksheet.Protect(ProtectionType.Contents, "aspose", "");

//disallowing users to select locked cells of the worksheet

worksheet.Protection.IsSelectingLockedCellsAllowed = false;

//Saving the modified Excel file

excel.Save("C:\\output.xls");

Please see the following links for different other advance protection options,

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/advanced-protection-settings-since-excel-xp.html

Also, please see the following thread for more details on your issue,

Thank You & Best Regards,