[]
        
(Showing Draft Content)

C1.Excel.XLPictureShape.-ctor

XLPictureShape Constructor

XLPictureShape(Image, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(Image img, int x, int y)
Parameters
Type Name Description
Image img

The image contained in the new XLPictureShape.

int x

The horizontal position of the new shape with respect to the cell, in twips.

int y

The vertical position of the new shape with respect to the cell, in twips.

Examples

The code below adds an image to a cell. The image is rendered in its original size, and is indented from the top left corner of the cell by 30 twips:

// get sheet and cell
XLSheet sheet = c1ExcelBook1.Sheets[0];
XLCell  cell  = sheet[row, col];

// build XLPictureShape
XLPictureShape pic = new XLPictureShape(image, 30, 30);

// assign XLPictureShape to cell
cell.Value = pic;

XLPictureShape(Image, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(Image img, int x, int y, int width, int height)
Parameters
Type Name Description
Image img

The image contained in the new XLPictureShape.

int x

The horizontal position of the image with respect to the cell, in twips.

int y

The vertical position of the image with respect to the cell, in twips.

int width

The width of the image, in twips.

int height

The height of the image, in twips.

Examples

The code below adds an image to a cell. The image is drawn within a rectangle centered on a cell with a 60 twip edge around it:

// get sheet and cell
XLSheet sheet = c1ExcelBook1.Sheets[0];
XLCell  cell  = sheet[row, col];

// calculate cell size to align picture
Rectangle rc = new Rectangle(0, 0
    sheet.Columns[col].Width, 
    sheet.Rows[row].Height);

// add 60 twip edge
rc.Inflate(-60, -60);

// build XLPictureShape
XLPictureShape pic = new XLPictureShape(image, 
    rc.X, rc.Y, rc.Width, rc.Height);

// assign XLPictureShape to cell
cell.Value = pic;

XLPictureShape(Image, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(Image img, RectangleF rc)
Parameters
Type Name Description
Image img

The image contained in the new XLPictureShape.

RectangleF rc

The rectangle that specifies the image size and position with respect to the cell, in twips.

Examples

The code below adds an image to a cell. The image is drawn within a rectangle centered on a cell with a 60 twip edge around it:

// get sheet and cell
XLSheet sheet = c1ExcelBook1.Sheets[0];
XLCell  cell  = sheet[row, col];

// calculate cell size to align picture
Rectangle rc = new Rectangle(0, 0
    sheet.Columns[col].Width, 
    sheet.Rows[row].Height);

// add 60 twip edge
rc.Inflate(-60, -60);

// build XLPictureShape
XLPictureShape pic = new XLPictureShape(image, rc);

// assign XLPictureShape to cell
cell.Value = pic;

XLPictureShape(Image)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(Image img)
Parameters
Type Name Description
Image img

The image contained in the new XLPictureShape.

XLPictureShape(Image, Size, XLAlignHorz, XLAlignVert, ImageScaling)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(Image img, Size cellSize, XLAlignHorz align, XLAlignVert valign, ImageScaling scale)
Parameters
Type Name Description
Image img

The GrapeCity.Documents.Drawing.Image contained in the new XLPictureShape.

Size cellSize

The size of the cell that will contain the image, in pixels (used for aligning the image).

XLAlignHorz align

A XLAlignHorz value that specifies the position of the image in the cell.

XLAlignVert valign

A XLAlignVert value that specifies the position of the image in the cell.

ImageScaling scale

An ImageScaling value that specifies the image scaling within the cell.

Remarks

This constructor automatically calculates the image size, position, and clipping based on the cell and image sizes and on the given alignment and scaling parameters.

XLPictureShape(XLSheet, Image, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(XLSheet sheet, Image img, int x, int y, int width, int height)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

Image img

The image contained in the new XLPictureShape.

int x

The horizontal position of the image with respect to the sheet, in twips.

int y

The vertical position of the image with respect to the sheet, in twips.

int width

The width of the image, in twips.

int height

The height of the image, in twips.

XLPictureShape(XLSheet, Image, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(XLSheet sheet, Image img, RectangleF rc)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

Image img

The image contained in the new XLPictureShape.

RectangleF rc

The rectangle that specifies the image size and position with respect to the cell, in twips.

XLPictureShape(GcBitmap, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(GcBitmap bitmap, int x, int y)
Parameters
Type Name Description
GcBitmap bitmap

The GcBitmap image source.

int x

The horizontal position of the new shape with respect to the cell, in twips.

int y

The vertical position of the new shape with respect to the cell, in twips.

XLPictureShape(GcBitmap, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(GcBitmap bitmap, int x, int y, int width, int height)
Parameters
Type Name Description
GcBitmap bitmap

The GcBitmap image source.

int x

The horizontal position of the image with respect to the cell, in twips.

int y

The vertical position of the image with respect to the cell, in twips.

int width

The width of the image, in twips.

int height

The height of the image, in twips.

XLPictureShape(GcBitmap, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(GcBitmap bitmap, RectangleF rc)
Parameters
Type Name Description
GcBitmap bitmap

The GcBitmap image source.

RectangleF rc

The rectangle that specifies the image size and position with respect to the cell, in twips.

XLPictureShape(GcBitmap)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(GcBitmap bitmap)
Parameters
Type Name Description
GcBitmap bitmap

The GcBitmap image source.

XLPictureShape(GcBitmap, Size, XLAlignHorz, XLAlignVert, ImageScaling)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(GcBitmap bitmap, Size cellSize, XLAlignHorz align, XLAlignVert valign, ImageScaling scale)
Parameters
Type Name Description
GcBitmap bitmap

The GcBitmap image source.

Size cellSize

The size of the cell that will contain the image, in pixels (used for aligning the image).

XLAlignHorz align

A XLAlignHorz value that specifies the position of the image in the cell.

XLAlignVert valign

A XLAlignVert value that specifies the position of the image in the cell.

ImageScaling scale

An ImageScaling value that specifies the image scaling within the cell.

Remarks

This constructor automatically calculates the image size, position, and clipping based on the cell and image sizes and on the given alignment and scaling parameters.

XLPictureShape(XLSheet, GcBitmap, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(XLSheet sheet, GcBitmap bitmap, int x, int y, int width, int height)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

GcBitmap bitmap

The GcBitmap image source.

int x

The horizontal position of the image with respect to the sheet, in twips.

int y

The vertical position of the image with respect to the sheet, in twips.

int width

The width of the image, in twips.

int height

The height of the image, in twips.

XLPictureShape(XLSheet, GcBitmap, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(XLSheet sheet, GcBitmap bitmap, RectangleF rc)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

GcBitmap bitmap

The GcBitmap image source.

RectangleF rc

The rectangle that specifies the image size and position with respect to the cell, in twips.

XLPictureShape(byte[], int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(byte[] data, int x, int y)
Parameters
Type Name Description
byte[] data

The binary data as image source.

int x

The horizontal position of the new shape with respect to the cell, in twips.

int y

The vertical position of the new shape with respect to the cell, in twips.

XLPictureShape(byte[], int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(byte[] data, int x, int y, int width, int height)
Parameters
Type Name Description
byte[] data

The binary data as image source.

int x

The horizontal position of the image with respect to the cell, in twips.

int y

The vertical position of the image with respect to the cell, in twips.

int width

The width of the image, in twips.

int height

The height of the image, in twips.

XLPictureShape(byte[], RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(byte[] data, RectangleF rc)
Parameters
Type Name Description
byte[] data

The binary data as image source.

RectangleF rc

The rectangle that specifies the image size and position with respect to the cell, in twips.

XLPictureShape(byte[])

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(byte[] data)
Parameters
Type Name Description
byte[] data

The binary data as image source.

XLPictureShape(byte[], Size, XLAlignHorz, XLAlignVert, ImageScaling)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(byte[] data, Size cellSize, XLAlignHorz align, XLAlignVert valign, ImageScaling scale)
Parameters
Type Name Description
byte[] data

The binary data as image source.

Size cellSize

The size of the cell that will contain the image, in pixels (used for aligning the image).

XLAlignHorz align

A XLAlignHorz value that specifies the position of the image in the cell.

XLAlignVert valign

A XLAlignVert value that specifies the position of the image in the cell.

ImageScaling scale

An ImageScaling value that specifies the image scaling within the cell.

Remarks

This constructor automatically calculates the image size, position, and clipping based on the cell and image sizes and on the given alignment and scaling parameters.

XLPictureShape(XLSheet, byte[], int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLSheet sheet, byte[] data, int x, int y, int width, int height)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

byte[] data

The binary data as image source.

int x

The horizontal position of the image with respect to the sheet, in twips.

int y

The vertical position of the image with respect to the sheet, in twips.

int width

The width of the image, in twips.

int height

The height of the image, in twips.

XLPictureShape(XLSheet, byte[], RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLSheet sheet, byte[] data, RectangleF rc)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

byte[] data

The binary data as image source.

RectangleF rc

The rectangle that specifies the image size and position with respect to the cell, in twips.

XLPictureShape(Stream, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(Stream stream, int x, int y)
Parameters
Type Name Description
Stream stream

The stream with image source.

int x

The horizontal position of the new shape with respect to the cell, in twips.

int y

The vertical position of the new shape with respect to the cell, in twips.

XLPictureShape(Stream, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(Stream stream, int x, int y, int width, int height)
Parameters
Type Name Description
Stream stream

The stream with image source.

int x

The horizontal position of the image with respect to the cell, in twips.

int y

The vertical position of the image with respect to the cell, in twips.

int width

The width of the image, in twips.

int height

The height of the image, in twips.

XLPictureShape(Stream, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(Stream stream, RectangleF rc)
Parameters
Type Name Description
Stream stream

The stream with image source.

RectangleF rc

The rectangle that specifies the image size and position with respect to the cell, in twips.

XLPictureShape(Stream)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(Stream stream)
Parameters
Type Name Description
Stream stream

The stream with image source.

XLPictureShape(Stream, Size, XLAlignHorz, XLAlignVert, ImageScaling)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(Stream stream, Size cellSize, XLAlignHorz align, XLAlignVert valign, ImageScaling scale)
Parameters
Type Name Description
Stream stream

The stream with image source.

Size cellSize

The size of the cell that will contain the image, in pixels (used for aligning the image).

XLAlignHorz align

A XLAlignHorz value that specifies the position of the image in the cell.

XLAlignVert valign

A XLAlignVert value that specifies the position of the image in the cell.

ImageScaling scale

An ImageScaling value that specifies the image scaling within the cell.

Remarks

This constructor automatically calculates the image size, position, and clipping based on the cell and image sizes and on the given alignment and scaling parameters.

XLPictureShape(XLSheet, Stream, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLSheet sheet, Stream stream, int x, int y, int width, int height)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

Stream stream

The stream with image source.

int x

The horizontal position of the image with respect to the sheet, in twips.

int y

The vertical position of the image with respect to the sheet, in twips.

int width

The width of the image, in twips.

int height

The height of the image, in twips.

XLPictureShape(XLSheet, Stream, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLSheet sheet, Stream stream, RectangleF rc)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

Stream stream

The stream with image source.

RectangleF rc

The rectangle that specifies the image size and position with respect to the cell, in twips.

XLPictureShape(string, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(string source, int x, int y)
Parameters
Type Name Description
string source

Text source as file path or base64 string data.

int x

The horizontal position of the new shape with respect to the cell, in twips.

int y

The vertical position of the new shape with respect to the cell, in twips.

XLPictureShape(string, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(string source, int x, int y, int width, int height)
Parameters
Type Name Description
string source

Text source as file path or base64 string data.

int x

The horizontal position of the image with respect to the cell, in twips.

int y

The vertical position of the image with respect to the cell, in twips.

int width

The width of the image, in twips.

int height

The height of the image, in twips.

XLPictureShape(string, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(string source, RectangleF rc)
Parameters
Type Name Description
string source

Text source as file path or base64 string data.

RectangleF rc

The rectangle that specifies the image size and position with respect to the cell, in twips.

XLPictureShape(string)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(string source)
Parameters
Type Name Description
string source

Text source as file path or base64 string data.

XLPictureShape(string, Size, XLAlignHorz, XLAlignVert, ImageScaling)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(string source, Size cellSize, XLAlignHorz align, XLAlignVert valign, ImageScaling scale)
Parameters
Type Name Description
string source

Text source as file path or base64 string data.

Size cellSize

The size of the cell that will contain the image, in pixels (used for aligning the image).

XLAlignHorz align

A XLAlignHorz value that specifies the position of the image in the cell.

XLAlignVert valign

A XLAlignVert value that specifies the position of the image in the cell.

ImageScaling scale

An ImageScaling value that specifies the image scaling within the cell.

Remarks

This constructor automatically calculates the image size, position, and clipping based on the cell and image sizes and on the given alignment and scaling parameters.

XLPictureShape(XLSheet, string, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLSheet sheet, string source, int x, int y, int width, int height)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

string source

Text source as file path or base64 string data.

int x

The horizontal position of the image with respect to the sheet, in twips.

int y

The vertical position of the image with respect to the sheet, in twips.

int width

The width of the image, in twips.

int height

The height of the image, in twips.

XLPictureShape(XLSheet, string, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLSheet sheet, string source, RectangleF rc)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

string source

Text source as file path or base64 string data.

RectangleF rc

The rectangle that specifies the image size and position with respect to the cell, in twips.