Method Add
- Namespace
- DocWright.Spreadsheet
- Assembly
- DocWright.Spreadsheet.dll
Add(byte[], string, XlsxPictureOptions?)
Adds a picture whose top-left corner is in a cell, the image's bytes stored as they are.
public XlsxPicture Add(byte[] data, string cell, XlsxPictureOptions? options = null)
Parameters
databyte[]A PNG or JPEG image.
cellstringThe cell, such as
B4.optionsXlsxPictureOptionsThe size, placement, name and alternative text; null for the image's own size, placed as Excel places a new picture.
Returns
- XlsxPicture
The picture.
Exceptions
- ArgumentException
The bytes are not a PNG or JPEG image whose header states its size, the cell is not a cell reference, or a size or offset is not positive or is past what a drawing states.
- ResourceLimitExceededException
The image states more pixels than MaxImagePixels of the settings the workbook was opened with.
- InvalidOperationException
The sheet is not a worksheet.
- InvalidDocumentException
A part of the workbook is malformed.
Add(Stream, string, XlsxPictureOptions?)
Adds a picture whose top-left corner is in a cell, the image read from a stream and stored as it is.
public XlsxPicture Add(Stream data, string cell, XlsxPictureOptions? options = null)
Parameters
dataStreamA stream of a PNG or JPEG image, read from where it stands to its end.
cellstringThe cell, such as
B4.optionsXlsxPictureOptions
Returns
- XlsxPicture
The picture.
Exceptions
- ArgumentException
- ResourceLimitExceededException
- InvalidOperationException
The sheet is not a worksheet.
- InvalidDocumentException
A part of the workbook is malformed.