Hi,
I am using the latest Aspose.Word. I had a Picture Content Control in my word.
After i locate the Content Control, i set a image into the sdt and set the width and height. However ,the image that i set will fit to the content control size. and the the width and height cannot set to the value i want.
For example, the size of the content control in word template is 10px x 10px. After i set the width to 1(did not set the height) from code, it will become 1px x 1px but not 10px x 1px.
here is my word and code:
foreach(StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true)) {
switch(sdt.SdtType) {
case SdtType.Picture:
Shape _shape= (Shape)sdt.GetChild(NodeType.Shape, 0, true);
Stream _stream = new MemoryStream(somePicByteArr);
dml.ImageData.SetImage(_stream);
_shape.Height = _height;
_shape.Width = _width;
}
}
By the way, i tried ConvertUtil.PixelToPoint(). the size did not match what i want and still have the problem above.
My question is how do i solve this problem? or any other way to do that?
here are the Word templates before editing, after editing and the expected result:
Aspose_Word.zip (91.8 KB)