Below is the example of using the SetWbkMd operation to change cell style. The request contains an instance of opened workbook and changed cell styles. The response contains an instance of the workbook to be changed.
{ "SetWbkMd" : { "tWbk" : { "id" : "S1!M!S!W7" }, "tArg" : { "pattern" : { "obInst" : "true", "styles" : "true" }, "meta" : { "styles" : { "splice" : { "tabStyle" : { "Font" : { "@C" : "#FF6A00" } }, "setDefault" : "false" }, "discrepancy" : { "tabStyle" : { "Font" : { "@I" : "true" } }, "setDefault" : "false" }, "forecast" : { "tabStyle" : { "Font" : { "@B" : "true" } }, "setDefault" : "false" } } } } } }
{ "SetWbkMdResult" : { "id" : { "id" : "S1!M!S!W7" } } }
The SetWbkStyle function changes style of workbook cells. Input parameters:
wbk. Opened workbook instance.
After execution the function returns data change result.
public static SetWbkMdResult SetWbkStyle(WbkId wbk) {// Set operation execution parameters var tOp = new SetWbkMd { tWbk = wbk, tArg = new SetWbkMdArg
{ // Set data change pattern pattern = new WbkMdPattern() {styles = true}, // Set changeable data meta = new WbkMd() { styles = new LnTabStyles() {// Style for cells with forecast data forecast = new LnCellStyle() {
setDefault = false, tabStyle = new TabStyle() { Font = new TabFontStyle { BSpecified = true, B = true } } },// Style for cells that are data source for spliced series
splice = new LnCellStyle() { setDefault = false, tabStyle = new TabStyle() { Font = new TabFontStyle {C = "#FF6A00"} } },// tyle for cells, which stored values differ from calculated ones discrepancy = new LnCellStyle()
{ setDefault = false, tabStyle = new TabStyle() { Font = new TabFontStyle { I = true, ISpecified = true } }
} } } } }; // Create proxy object for operation execution var somClient = new SomPortTypeClient(); // Execute operation SetWbkMdResult sRes = somClient.SetWbkMd(tOp); return sRes; }
See also: