IsDecorative
ShapeBase.IsDecorative property
获取或设置指定形状在文档中是否具有装饰性的标志。
public bool IsDecorative { get; set; }
评论
注意形状不为空AlternativeText
不能是装饰性的。
例子
展示如何设置形状的装饰性。
Document doc = new Document(MyDir + "Decorative shapes.docx");
Shape shape = (Shape)doc.GetChildNodes(NodeType.Shape, true)[0];
Assert.True(shape.IsDecorative);
// 如果“AlternativeText”不为空,则该形状不能具有装饰性。
// 这就是为什么我们的值变为“false”的原因。
shape.AlternativeText = "Alternative text.";
Assert.False(shape.IsDecorative);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToDocumentEnd();
// 创建一个新的形状作为装饰。
shape = builder.InsertShape(ShapeType.Rectangle, 100, 100);
shape.IsDecorative = true;
doc.Save(ArtifactsDir + "Shape.IsDecorative.docx");
也可以看看
- class ShapeBase
- 命名空间 Aspose.Words.Drawing
- 部件 Aspose.Words