bool SetStyle(string mon, StyleMetaData tArg)
mon. Moniker containing information about cell range or table area which formatting must be changed.
tArg. Formatting style parameters that should be applied to table area.
The SetStyle operation changes formatting style for the cell range or selected table range displayed analytical data area.
To execute the operation, in the mon field specify the moniker in the following format:
To work with the cell range: «Regular report instance moniker!Sheets!<Sheet key>!<absolute address>!Style». Absolute address can be specified in various formats that are allowed for cells, for example: A5, A5:D10, R5C3, C:C, 43:43.
To work with the specified table area: «Regular report instance moniker!DataArea!DataSources!<source key>!DataSourceSlices!<slice key>!Views!<table key>!EaxTableStyle!».
This moniker should also be appended with one of the following values:
Internal - to change data area formatting.
Top - to change columns header formatting.
Left - to change rows header formatting.
The moniker can be obtained on executing the OpenPrxMeta operation.
To change formatting style set for control block, set the moniker obtained in the meta.calcObjet.validBlock.style field after executing the GetAlg operation.
In the tArg.style field specify formatting style parameters that should be applied.
The operation returns True if, formatting is applied successfully.
Below is the example of changing table column header formatting. The request contains table area moniker and parameters of applied style. The response contains whether formatting style is successfully applied.
{
"SetStyle" :
{
"mon" : "S1!M!S!P1!DataArea!DataSources!1!DataSourceSlices!1!Views!3!EaxTableStyle!Top",
"tArg" :
{
"style" :
{
"Text" :
{
"@VA" : "1",
"@HA" : "1",
"@M" : "7px 6px 8px 6px",
"@WW" : "1"
},
"NumberFormat" :
{
"@F" : "",
"@FT" : "0"
},
"Font" :
{
"@B" : "true",
"@S" : "8",
"@F" : "Arial",
"@H" : "12"
},
"Borders" : "",
"Hyperlink" : ""
}
}
}
}
{
"SetStyleResult" : "1"
}
public static bool SetSpecificRangeStyle(string moniker, uint sourceKey, uint sliceKey, uint viewKey, TabStyle newStyle)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetStyle()
{
tArg = new StyleMetaData()
{
style = newStyle
},
mon = moniker + "!DataArea!DataSources!" + sourceKey.ToString() + "!DataSourceSlices!" + sliceKey.ToString() + "!Views!" + viewKey.ToString() + "!EaxTableStyle!Top"
};
//Change style
var result = somClient.SetStyle(tSet);
return result;
}
See also: