TabNamedRegionOpResult AddTabNamedRegion(NamedRegionsId nrMon, TabNamedRegion Region)
nrMon. Moniker for working with named ranges.
Region. Parameters of added named range.
The AddTabNamedRegion operation creates a named range on a regular report sheet.
To execute the operation, in the nrMon field specify regular report instance moniker with the !Sheets!Sheet key!NamedRegions postfix, and in the Region field specify parameters of created named range. The moniker can be obtained on executing the OpenPrxMeta operation.
The operation results in the information about successful named range creation.
Below is the example of creating a named range on the first sheet of regular report. The request contains moniker for working with named ranges and created range settings. The response contains whether creation is successful and name of the created named range.
{
"AddTabNamedRegion" :
{
"nrMon" :
{
"id" : "ILBNJNHKDBCAGOAEGGMCAJHIOKJPOKMEOIOADBDOFONILPAG!M!S!PAJBBFBIKDBCAGOAEJOAGHLNCNALCNCJEOLBLLFIDBFHIGLPO!Sheets!1!NamedRegions"
},
"Region" :
{
"left" : "1",
"top" : "1",
"width" : "10",
"height" : "2",
"borderColor" : "4294901760",
"name" : "Header"
}
}
}
{
"AddTabNamedRegionResult" :
{
"res" : "1",
"name" : "Header"
}
}
public static TabNamedRegionOpResult AddTabNamedRegion(string moniker, string regionName, int leftCell, int topCell, uint bottomCell, uint rightCell)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tAdd = new AddTabNamedRegion()
{
nrMon = new NamedRegionsId() { id = moniker + "!Sheets!1!NamedRegions" },
Region = new TabNamedRegion()
{
left = leftCell,
top = topCell,
height = bottomCell,
width = rightCell,
name = regionName,
borderColor = 4294901760 // Red
}
};
// Create a named range
var result = somClient.AddTabNamedRegion(tAdd);
return result;
}
See also: