[]
        
(Showing Draft Content)

C1.Excel.XLPictureShape.-ctor

XLPictureShape Constructor

XLPictureShape(XLImage, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLImage img, int x, int y)
Public Sub New(img As XLImage, x As Integer, y As Integer)
Parameters
Type Name Description
XLImage 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(XLImage, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLImage img, int x, int y, int width, int height)
Public Sub New(img As XLImage, x As Integer, y As Integer, width As Integer, height As Integer)
Parameters
Type Name Description
XLImage 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(XLImage, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLImage img, RectangleF rc)
Public Sub New(img As XLImage, rc As RectangleF)
Parameters
Type Name Description
XLImage 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(XLImage)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLImage img)
Public Sub New(img As XLImage)
Parameters
Type Name Description
XLImage img

The image contained in the new XLPictureShape.

XLPictureShape(XLImage, SizeF, XLAlignHorz, XLAlignVert, ImageScaling)

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(XLImage img, SizeF cellSize, XLAlignHorz align, XLAlignVert valign, ImageScaling scale)
Public Sub New(img As XLImage, cellSize As SizeF, align As XLAlignHorz, valign As XLAlignVert, scale As ImageScaling)
Parameters
Type Name Description
XLImage img

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

SizeF 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, XLImage, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(XLSheet sheet, XLImage img, int x, int y, int width, int height)
<CLSCompliant(False)>
Public Sub New(sheet As XLSheet, img As XLImage, x As Integer, y As Integer, width As Integer, height As Integer)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

XLImage 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, XLImage, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(XLSheet sheet, XLImage img, RectangleF rc)
<CLSCompliant(False)>
Public Sub New(sheet As XLSheet, img As XLImage, rc As RectangleF)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

XLImage 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(IImage, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(IImage image, int x, int y)
<CLSCompliant(False)>
Public Sub New(image As IImage, x As Integer, y As Integer)
Parameters
Type Name Description
IImage image

The GrapeCity.Documents.Drawing.IImage 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(IImage, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(IImage image, int x, int y, int width, int height)
<CLSCompliant(False)>
Public Sub New(image As IImage, x As Integer, y As Integer, width As Integer, height As Integer)
Parameters
Type Name Description
IImage image

The GrapeCity.Documents.Drawing.IImage 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(IImage, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(IImage image, RectangleF rc)
<CLSCompliant(False)>
Public Sub New(image As IImage, rc As RectangleF)
Parameters
Type Name Description
IImage image

The GrapeCity.Documents.Drawing.IImage source.

RectangleF rc

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

XLPictureShape(IImage)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(IImage image)
<CLSCompliant(False)>
Public Sub New(image As IImage)
Parameters
Type Name Description
IImage image

The GrapeCity.Documents.Drawing.IImage source.

XLPictureShape(IImage, SizeF, XLAlignHorz, XLAlignVert, ImageScaling)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(IImage image, SizeF cellSize, XLAlignHorz align, XLAlignVert valign, ImageScaling scale)
<CLSCompliant(False)>
Public Sub New(image As IImage, cellSize As SizeF, align As XLAlignHorz, valign As XLAlignVert, scale As ImageScaling)
Parameters
Type Name Description
IImage image

The GrapeCity.Documents.Drawing.IImage source.

SizeF 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, IImage, int, int, int, int)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(XLSheet sheet, IImage image, int x, int y, int width, int height)
<CLSCompliant(False)>
Public Sub New(sheet As XLSheet, image As IImage, x As Integer, y As Integer, width As Integer, height As Integer)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

IImage image

The GrapeCity.Documents.Drawing.IImage 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, IImage, RectangleF)

Initializes a new instance of an XLPictureShape.

Declaration
[CLSCompliant(false)]
public XLPictureShape(XLSheet sheet, IImage image, RectangleF rc)
<CLSCompliant(False)>
Public Sub New(sheet As XLSheet, image As IImage, rc As RectangleF)
Parameters
Type Name Description
XLSheet sheet

XLSheet object that owns the new shape.

IImage image

The GrapeCity.Documents.Drawing.IImage 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)
Public Sub New(data As Byte(), x As Integer, y As Integer)
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)
Public Sub New(data As Byte(), x As Integer, y As Integer, width As Integer, height As Integer)
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)
Public Sub New(data As Byte(), rc As RectangleF)
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)
Public Sub New(data As Byte())
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)
Public Sub New(data As Byte(), cellSize As Size, align As XLAlignHorz, valign As XLAlignVert, scale As ImageScaling)
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)
Public Sub New(sheet As XLSheet, data As Byte(), x As Integer, y As Integer, width As Integer, height As Integer)
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)
Public Sub New(sheet As XLSheet, data As Byte(), rc As RectangleF)
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)
Public Sub New(stream As Stream, x As Integer, y As Integer)
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)
Public Sub New(stream As Stream, x As Integer, y As Integer, width As Integer, height As Integer)
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)
Public Sub New(stream As Stream, rc As RectangleF)
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)
Public Sub New(stream As Stream)
Parameters
Type Name Description
Stream stream

The stream with image source.

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

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(Stream stream, SizeF cellSize, XLAlignHorz align, XLAlignVert valign, ImageScaling scale)
Public Sub New(stream As Stream, cellSize As SizeF, align As XLAlignHorz, valign As XLAlignVert, scale As ImageScaling)
Parameters
Type Name Description
Stream stream

The stream with image source.

SizeF 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)
Public Sub New(sheet As XLSheet, stream As Stream, x As Integer, y As Integer, width As Integer, height As Integer)
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)
Public Sub New(sheet As XLSheet, stream As Stream, rc As RectangleF)
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)
Public Sub New(source As String, x As Integer, y As Integer)
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)
Public Sub New(source As String, x As Integer, y As Integer, width As Integer, height As Integer)
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)
Public Sub New(source As String, rc As RectangleF)
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)
Public Sub New(source As String)
Parameters
Type Name Description
string source

Text source as file path or base64 string data.

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

Initializes a new instance of an XLPictureShape.

Declaration
public XLPictureShape(string source, SizeF cellSize, XLAlignHorz align, XLAlignVert valign, ImageScaling scale)
Public Sub New(source As String, cellSize As SizeF, align As XLAlignHorz, valign As XLAlignVert, scale As ImageScaling)
Parameters
Type Name Description
string source

Text source as file path or base64 string data.

SizeF 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)
Public Sub New(sheet As XLSheet, source As String, x As Integer, y As Integer, width As Integer, height As Integer)
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)
Public Sub New(sheet As XLSheet, source As String, rc As RectangleF)
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.