AddFreeFloatingShape
ShapeCollection.AddFreeFloatingShape method
向工作表添加自由浮动形状。仅适用于线条/图像形状。
public Shape AddFreeFloatingShape(MsoDrawingType type, int top, int left, int height, int width,
byte[] imageData, bool isOriginalSize)
范围 | 类型 | 描述 |
---|---|---|
type | MsoDrawingType | 形状类型。 |
top | Int32 | 表示形状与工作表顶行的垂直偏移,以像素为单位。 |
left | Int32 | 表示形状与工作表左列的水平偏移,以像素为单位。 |
height | Int32 | 表示 LineShape 的高度,以像素为单位。 |
width | Int32 | 表示 LineShape 的宽度,以像素为单位。 |
imageData | Byte[] | 图片数据,仅适用于图片。 |
isOriginalSize | Boolean | 如果形状是图像,形状是否使用原始大小。 |
例子
[C#]
//添加一行
Shape floatingShape_Line = shapes.AddFreeFloatingShape(MsoDrawingType.Line, 100, 100, 100, 50, null, false);
//添加图片
byte[] imageData = null;
using(FileStream fs = new FileStream("image.jpg", FileMode.Open))
{
int len = (int)fs.Length;
imageData = new byte[len];
fs.Read(imageData, 0, len);
}
Shape floatingShape_Picture = shapes.AddFreeFloatingShape(MsoDrawingType.Picture, 200, 100, 100, 50, imageData, false);
也可以看看
- class Shape
- enum MsoDrawingType
- class ShapeCollection
- 命名空间 Aspose.Cells.Drawing
- 部件 Aspose.Cells