Hi,
I've protected my workbook and worksheet using following functions.
private void ProtectWorkbook(String password, Workbook exlSheet, Template template)
{
if (template.IsProtected) {
exlSheet.Protect(ProtectionType.Structure, password);
}
}
private void AddProtection(Worksheet localSheet, TWorksheet sheet)
{
localSheet.Protection.IsDeletingColumnsAllowed = false;
localSheet.Protection.IsDeletingRowsAllowed = false;
localSheet.Protection.IsEditingContentsAllowed = true;
localSheet.Protection.IsEditingObjectsAllowed = false;
localSheet.Protection.IsEditingScenariosAllowed = false;
localSheet.Protection.IsFilteringAllowed = false;
localSheet.Protection.IsFormattingCellsAllowed = false;
localSheet.Protection.IsFormattingColumnsAllowed = false;
localSheet.Protection.IsFormattingRowsAllowed = false;
localSheet.Protection.IsInsertingColumnsAllowed = false;
localSheet.Protection.IsInsertingHyperlinksAllowed = false;
localSheet.Protection.IsInsertingRowsAllowed = false;
localSheet.Protection.IsSelectingLockedCellsAllowed = true;
localSheet.Protection.IsSortingAllowed = false;
localSheet.Protection.IsUsingPivotTablesAllowed = false;
localSheet.Protect(ProtectionType.All, this.WorkSheetPassword, null);
}
Problem is, when I open is for the first time; it shows a password prompt. How to supress that?
Regards, Vinay