FitImageToShape

ImageData.FitImageToShape method

将图像数据适合 Shape 框架,以便图像数据的纵横比与 Shape 框架的纵横比相匹配。

public void FitImageToShape()

例子

显示如何将图像数据适合形状框架。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// 插入图像形状并保持其方向为默认状态。
Shape shape = builder.InsertShape(ShapeType.Rectangle, 300, 450);
shape.ImageData.SetImage(ImageDir + "Barcode.png");
shape.ImageData.FitImageToShape();

doc.Save(ArtifactsDir + "Shape.FitImageToShape.docx");

也可以看看