[]
Initializes a new instance of an XLPictureShape.
public XLPictureShape(WriteableBitmap img, int x, int y)
Type | Name | Description |
---|---|---|
WriteableBitmap | 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. |
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;
Initializes a new instance of an XLPictureShape.
public XLPictureShape(WriteableBitmap img, int x, int y, int width, int height)
Type | Name | Description |
---|---|---|
WriteableBitmap | 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. |
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;
Initializes a new instance of an XLPictureShape.
public XLPictureShape(WriteableBitmap img, Rect rc)
Type | Name | Description |
---|---|---|
WriteableBitmap | img | The image contained in the new XLPictureShape. |
Rect | rc | The rectangle that specifies the image size and position with respect to the cell, in twips. |
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;
Initializes a new instance of an XLPictureShape.
public XLPictureShape(WriteableBitmap img)
Type | Name | Description |
---|---|---|
WriteableBitmap | img | The image contained in the new XLPictureShape. |
Initializes a new instance of an XLPictureShape.
public XLPictureShape(WriteableBitmap img, Size cellSize, HorizontalAlignment align, VerticalAlignment valign, ImageScaling scale)
Type | Name | Description |
---|---|---|
WriteableBitmap | img | The WriteableBitmap contained in the new XLPictureShape. |
Size | cellSize | The size of the cell that will contain the image, in pixels (used for aligning the image). |
HorizontalAlignment | align | A HorizontalAlignment value that specifies the position of the image in the cell. |
VerticalAlignment | valign | A VerticalAlignment value that specifies the position of the image in the cell. |
ImageScaling | scale | An ImageScaling value that specifies the image scaling within the cell. |
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.
Initializes a new instance of an XLPictureShape.
public XLPictureShape(XLSheet sheet, WriteableBitmap img, double x, double y, double width, double height)
Type | Name | Description |
---|---|---|
XLSheet | sheet | XLSheet object that owns the new shape. |
WriteableBitmap | img | The image contained in the new XLPictureShape. |
double | x | The horizontal position of the image with respect to the sheet, in twips. |
double | y | The vertical position of the image with respect to the sheet, in twips. |
double | width | The width of the image, in twips. |
double | height | The height of the image, in twips. |
Initializes a new instance of an XLPictureShape.
public XLPictureShape(C1Bitmap bmp, int x, int y)
Type | Name | Description |
---|---|---|
C1Bitmap | bmp | The specified bitmap object 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. |
Initializes a new instance of an XLPictureShape.
public XLPictureShape(C1Bitmap bmp, int x, int y, int width, int height)
Type | Name | Description |
---|---|---|
C1Bitmap | bmp | The specified bitmap object 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. |
Initializes a new instance of an XLPictureShape.
public XLPictureShape(C1Bitmap bmp, Rect rc)
Type | Name | Description |
---|---|---|
C1Bitmap | bmp | The specified bitmap object contained in the new XLPictureShape. |
Rect | rc | The rectangle that specifies the image size and position with respect to the cell, in twips. |
Initializes a new instance of an XLPictureShape.
public XLPictureShape(C1Bitmap bmp)
Type | Name | Description |
---|---|---|
C1Bitmap | bmp | The specified bitmap object contained in the new XLPictureShape. |
Initializes a new instance of an XLPictureShape.
public XLPictureShape(C1Bitmap bmp, Size cellSize, HorizontalAlignment align, VerticalAlignment valign, ImageScaling scale)
Type | Name | Description |
---|---|---|
C1Bitmap | bmp | The specified bitmap object contained in the new XLPictureShape. |
Size | cellSize | The size of the cell that will contain the image, in pixels (used for aligning the image). |
HorizontalAlignment | align | A horizontal content alignment value that specifies the position of the image in the cell. |
VerticalAlignment | valign | A VerticalAlignment value that specifies the position of the image in the cell. |
ImageScaling | scale | An ImageScaling value that specifies the image scaling within the cell. |
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.
Initializes a new instance of an XLPictureShape.
public XLPictureShape(XLSheet sheet, C1Bitmap bmp, double x, double y, double width, double height)
Type | Name | Description |
---|---|---|
XLSheet | sheet | XLSheet object that owns the new shape. |
C1Bitmap | bmp | The specified bitmap object contained in the new XLPictureShape. |
double | x | The horizontal position of the image with respect to the sheet, in twips. |
double | y | The vertical position of the image with respect to the sheet, in twips. |
double | width | The width of the image, in twips. |
double | height | The height of the image, in twips. |