SetTabProtectionResult SetTabProtection(TabSheetId tTabSheet, TabProtectionExArg tArg)
tTabSheet. Sheet table moniker.
tArg. Operation execution parameters.
The SetTabProtection operation changes regular report sheet table protection.
To execute the operation, in the tTabSheet field specify table moniker, and in the tArg field specify set protection parameters. The moniker is specified in the following format: Regular report instance moniker!sheet key. To remove protection, in the tArg.protection field specify the value that does not contain the element that is responsible for activation (element with the 1 value).
The operation results in the logical value that determines whether sheet table protection is changed.
Below is the example of setting regular report sheet table protection. The request contains sheet moniker, required protection level, and password. The response contains whether protection is successfully changed.
{
"SetTabProtection" :
{
"tTabSheet" :
{
"id" : "NIKLFCDENADGGOAEENCHFLADKBGCAHKEIJNDAILBBLMMBJMM!M!S!POJMOCFDENADGGOAELFPMGJIFMKJKLIFEMIAAHNPBJKILIHJL!Sheets!2"
},
"tArg" :
{
"protection" : "33",
"password" : "password"
}
}
}
{
"SetTabProtectionResult" :
{
"isSuccessful" : "1"
}
}
public static SetTabProtectionResult SetTabProtection(string moniker, string sheetKey, string secPassword)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tSet = new SetTabProtection()
{
tArg = new TabProtectionExArg()
{
password = secPassword,
protection = 33 // Protection activated (1) + Enable table objects editing (32)
},
tTabSheet = new TabSheetId() { id = moniker + "!Sheets!" + sheetKey }
};
// Set sheet protection
var result = somClient.SetTabProtection(tSet);
return result;
}
See also: