See below example of using the SetWspMd operation to create a new shape - rectangle. The request sends the template specifying if it is required to create a new rectangle. The response contains rectangle settings.
{
"SetWspMd" :
{
"tWsp" :
{
"id" : "S1!M!S!WSP1"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"action" :
{
"CreateRectangle" : "true"
}
},
"meta" : ""
}
}
}
{
"SetWspMdResult" :
{
"id" :
{
"id" : "S1!M!S!WSP1"
},
"meta" :
{
"createdRectangle" :
{
"ChildShapes" :
{
"its" : ""
},
"Workspace" : "",
"Id" : "Shape5",
"Parent" : "",
"Style" :
{
"Workspace" : "",
"Id" : "Normal",
"IsPrivate" : "0",
"ChildStyles" : "",
"TextFontFamilyName" : "Arial",
"TextFontSize" : "10",
"TextFontStyleBold" : "0",
"TextFontStyleItalic" : "0",
"TextFontStyleUnderline" : "0",
"TextFontStyleStrikeout" : "0",
"TextFontBrushColor" : "4278190080",
"TextFontBrushTransparent" : "0",
"LinePenColor" : "4287336599",
"LinePenTransparent" : "0",
"LinePenWxDashStyle" : "Solid",
"LinePenWidth" : "0.3533568978309631",
"LinePenCapSize" : "2",
"LinePenBeginWxCap" : "Flat",
"LinePenEndWxCap" : "Flat",
"BackgroundBrushForeColor" : "4294967295",
"BackgroundBrushForeTransparent" : "0",
"BackgroundBrushPattern" : "Solid",
"BackgroundBrushBackColor" : "4278190080",
"BackgroundBrushBackTransparent" : "0",
"ShadowBrushForeColor" : "4278190080",
"ShadowBrushForeTransparent" : "0",
"ShadowBrushPattern" : "None",
"ShadowBrushBackColor" : "4294967295",
"ShadowBrushBackTransparent" : "0",
"TextBackBrushColor" : "4294967295",
"TextBackBrushTransparent" : "100",
"TextPosition" : "Over",
"TextAlignmentHorizontal" : "Center",
"TextAlignmentVertical" : "Center",
"TextMarginLeft" : "0",
"TextMarginTop" : "0",
"TextMarginRight" : "0",
"TextMarginBottom" : "0",
"PictureTransparent" : "0",
"PictureAlignmentHorizontal" : "Center",
"PictureAlignmentVertical" : "Center",
"PictureMarginLeft" : "0",
"PictureMarginTop" : "0",
"PictureMarginRight" : "0",
"PictureMarginBottom" : "0",
"AdjustMode" : "None",
"WordWrap" : "BreakWords",
"PictureProportional" : "0",
"PictureStretch" : "0",
"PictureAutoSize" : "0"
},
"SelectionStyle" :
{
"Workspace" : "",
"Id" : "Selection",
"IsPrivate" : "0",
"ChildStyles" : "",
"TextFontFamilyName" : "Arial",
"TextFontSize" : "10",
"TextFontStyleBold" : "0",
"TextFontStyleItalic" : "0",
"TextFontStyleUnderline" : "0",
"TextFontStyleStrikeout" : "0",
"TextFontBrushColor" : "4278190080",
"TextFontBrushTransparent" : "0",
"LinePenColor" : "4287336599",
"LinePenTransparent" : "0",
"LinePenWxDashStyle" : "Solid",
"LinePenWidth" : "0.3533568978309631",
"LinePenCapSize" : "2",
"LinePenBeginWxCap" : "Flat",
"LinePenEndWxCap" : "Flat",
"BackgroundBrushForeColor" : "4294967295",
"BackgroundBrushForeTransparent" : "0",
"BackgroundBrushPattern" : "Solid",
"BackgroundBrushBackColor" : "4278190080",
"BackgroundBrushBackTransparent" : "0",
"ShadowBrushForeColor" : "4278190080",
"ShadowBrushForeTransparent" : "0",
"ShadowBrushPattern" : "None",
"ShadowBrushBackColor" : "4294967295",
"ShadowBrushBackTransparent" : "0",
"TextBackBrushColor" : "4294967295",
"TextBackBrushTransparent" : "100",
"TextPosition" : "Over",
"TextAlignmentHorizontal" : "Center",
"TextAlignmentVertical" : "Center",
"TextMarginLeft" : "0",
"TextMarginTop" : "0",
"TextMarginRight" : "0",
"TextMarginBottom" : "0",
"PictureTransparent" : "0",
"PictureAlignmentHorizontal" : "Center",
"PictureAlignmentVertical" : "Center",
"PictureMarginLeft" : "0",
"PictureMarginTop" : "0",
"PictureMarginRight" : "0",
"PictureMarginBottom" : "0",
"AdjustMode" : "None",
"WordWrap" : "BreakWords",
"PictureProportional" : "0",
"PictureStretch" : "0",
"PictureAutoSize" : "0"
},
"TransparentColor" : "0",
"PinPosition" :
{
"x" : "0",
"y" : "0"
},
"LocalPinPositionCoeff" :
{
"x" : "0.5",
"y" : "0.5"
},
"Size" :
{
"width" : "30",
"height" : "20"
},
"Angle" : "0",
"Text" : "",
"TextVertOffset" : "0",
"TextHorzOffset" : "0",
"GroupBehaviour" : "ScaleWithGroup",
"DrawType" : "ShapeDefault",
"Cursor" : "OverShape",
"Tag" :
{
"v" : ""
},
"ConnectionPoints" :
{
"it" :
[
{
"x" : "-15",
"y" : "-0"
},
{
"x" : "-0",
"y" : "-10"
},
{
"x" : "15",
"y" : "-0"
},
{
"x" : "-0",
"y" : "10"
},
{
"x" : "-0",
"y" : "-0"
}
]
},
"ConnectedShapes" : "",
"FormattedText" : "{\rtf1{\*\DCF FF bius, TC 0, BC 16777215, FN Arial, FS 200}{\*\WORDWRAP 1}{\*\VERTICALALIGNMENT 1}{\*\HORIZONTAL_ALIGNMENT_V2 ,CENTER}{\*\GENERALALIGNMENT 0}\ansi\ansicpg1251\deff0\nouicompat\deflang1049{\fonttbl{\f0\fnil\fcharset0 Arial;}} {\colortbl ;\red0\green0\blue0;\red255\green255\blue255;} {\*\generator Riched20 10.0.14393}\viewkind4\uc1 \pard\qc\cf1\highlight2\fs20\lang1033\par } ",
"AllowedInteractions" : "511",
"MinSize" :
{
"width" : "0",
"height" : "0"
},
"LoadingVersion" : "14",
"PositionRect" :
{
"left" : "-15",
"top" : "-10",
"width" : "30",
"height" : "20"
},
"RequiredActiveWndRect" :
{
"left" : "15",
"top" : "10",
"width" : "0",
"height" : "0"
},
"Visible" : "1",
"Type" : "Rectangle"
}
}
}
}
public static SetWspMdResult WspCreateRectangle(WspId moniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetWspMd()
{
tArg = new SetWspMdArg()
{
pattern = new WspMdPattern()
{
action = new IWrspWorkspaceAction()
{
CreateRectangle = true
}
},
meta = new WspMd()
},
tWsp = moniker
};
//Create a rectangle
var tResult = somClient.SetWspMd(tSet);
return tResult;
}
See also: