StyleSheetItemMetadata CreateStyleSheetItem(StyleSheetId tStyleSheet)
tStyleSheet. Moniker of opened styles table instance.
The CreateStyleSheetItem operation creates a styles in styles table.
To execute the operation, in the tStyleSheet field specify moniker of opened styles table instance. The moniker can be obtained on executing the OpenStyleSheet operation.
The operation results in the metadata of created style.
The further work with a single style is executed using the GetStyleSheetItem/SetStyleSheetItem operations.
Below is the example of creating a style in styles table. The request contains moniker of opened styles table instance. The response contains information about the created style.
{
"CreateStyleSheetItem" :
{
"tStyleSheet" :
{
"id" : "CPDKLBGLHHOOFOAEEOBMIPONHEFJBEBEOLJEMAEIDCPLAAGC!M!S!SDJNKBJGLHHOOFOAENACKGIKGBKMHOKOEOJBIKCBEOKJJAPGE"
}
}
}
{
"CreateStyleSheetItemResult" :
{
"h" :
{
"key" : "2",
"tag" : "TAB",
"name" : "Style1",
"id" : "I2"
},
"style" :
{
"@B" : "",
"@UNS" : "0",
"Text" :
{
"@VA" : "0",
"@Mmm" : "0.65 0.65 0.65 0.65",
"@HA" : "0",
"@WW" : "0"
},
"NumberFormat" :
{
"@F" : "",
"@FT" : "0"
},
"Font" :
{
"@A" : "0",
"@B" : "false",
"@SO" : "false",
"@S" : "8",
"@C" : "#000000",
"@U" : "false",
"@F" : "Arial",
"@TR" : "0",
"@H" : "12",
"@I" : "false"
},
"Borders" :
{
"Border" :
[
{
"@S" : "7",
"@C" : "#000000",
"@W" : "2",
"@I" : "0"
},
{
"@S" : "7",
"@C" : "#000000",
"@W" : "2",
"@I" : "1"
},
{
"@S" : "7",
"@C" : "#000000",
"@W" : "2",
"@I" : "2"
},
{
"@S" : "7",
"@C" : "#000000",
"@W" : "2",
"@I" : "3"
},
{
"@S" : "7",
"@C" : "#000000",
"@W" : "2",
"@I" : "4"
},
{
"@S" : "7",
"@C" : "#000000",
"@W" : "2",
"@I" : "5"
},
{
"@S" : "7",
"@I" : "6"
},
{
"@S" : "7",
"@I" : "7"
}
]
},
"PictureData" :
{
"@E" : "false"
},
"Hyperlink" :
{
"@A" : "",
"@T" : ""
},
"ContainerInfo" :
{
"@key" : "2",
"@sheetType" : "0"
},
"Other" :
{
"@P" : "1",
"@H" : "",
"@DEA" : "",
"@L" : "0",
"@FH" : "0",
"@DZA" : ""
}
}
}
}
public static StyleSheetItemMetadata CreateStyleSheetItem(string moniker)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tCreate = new CreateStyleSheetItem()
{
tStyleSheet = new StyleSheetId() { id = moniker }
};
// Create a style in styles table
var result = somClient.CreateStyleSheetItem(tCreate);
return result;
}
See also: